
/**
 * Adjacency Matrix implementation of a simple graph.
 *   @param <E> 
 *   @author Dave Reed
 *   @version 11/18/13
 */
public class GraphList<E> extends DiGraphList<E> {
    
    /**
     * Constructs an empty simple graph.
     */
    public GraphList() {
        super();
    }
    
    /**
     * 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
     */
    public void addEdge(E v1, E v2) {
        super.addEdge(v1, v2);
        super.addEdge(v2, v1);
    }
    
    ////////////////////////////////////////////////////////////////
    
    public static void main(String[] args) {
        Graph<String> words = new GraphList<String>();
        words.addEdge("foo", "bar");
        words.addEdge("foo", "biz");
        words.addEdge("bar", "boo");
        words.addEdge("boo", "foo");
        
        System.out.println(words.getAdj("foo"));
        System.out.println(words.getAdj("bar"));
        System.out.println(words.getAdj("biz"));
        System.out.println(words.getAdj("boo"));
        
        System.out.println(words.containsEdge("foo", "biz") + " " +
                           words.containsEdge("foo", "boo"));
    }
}
