import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
import javafx.util.Pair;

/**
 * Adjacency Matrix implementation of a simple graph.
 *   @param <E> 
 *   @author Dave Reed
 *   @version 11/25/16
 */
public class GraphMatrix<E> extends DiGraphMatrix<E> {
        
    /**
     * Constructs an empty simple graph.
     */
    public GraphMatrix(List<Pair<E, E>> edges) {
        super(edges);
    }
   
    /**
     * Adds an edge to the graph.
     *   @param v1 the vertex at the start of the edge
     *   @param v2 the vertex at the end of the edge
     */
    protected void addEdge(E v1, E v2) {
        super.addEdge(v1, v2);
        super.addEdge(v2, v1);
    }
    
    ////////////////////////////////////////////////////////////////
    
     public static void main(String[] args) {
        List<Pair<String, String>> edges = new ArrayList<Pair<String, String>>();
        edges.add(new Pair<String, String>("foo", "bar"));
        edges.add(new Pair<String, String>("foo", "biz"));
        edges.add(new Pair<String, String>("bar", "boo"));
        edges.add(new Pair<String, String>("boo", "foo"));
        
        Graph<String> words = new GraphList<String>(edges);
        
        System.out.println(words.getAllAdjacent("foo"));
        System.out.println(words.getAllAdjacent("bar"));
        System.out.println(words.getAllAdjacent("biz"));
        System.out.println(words.getAllAdjacent("boo"));
        
        System.out.println(words.isAdjacentTo("foo", "biz") + " " +
                           words.isAdjacentTo("foo", "boo"));
    }
}

