1  public interface Graph<V> {
  2    /** Return the number of vertices in the graph */
  3    public int getSize();
  4  
  5    /** Return the vertices in the graph */
  6    public java.util.List<V> getVertices();
  7  
  8    /** Return the object for the specified vertex index */
  9    public V getVertex(int index);
 10  
 11    /** Return the index for the specified vertex object */
 12    public int getIndex(V v);
 13  
 14    /** Return the neighbors of vertex with the specified index */
 15    public java.util.List<Integer> getNeighbors(int index);
 16  
 17    /** Return the degree for a specified vertex */
 18    public int getDegree(int v);
 19  
 20    /** Print the edges */
 21    public void printEdges();
 22  
 23    /** Clear the graph */
 24    public void clear();
 25  
 26    /** Add a vertex to the graph */  
 27    public boolean addVertex(V vertex);
 28  
 29    /** Add an edge (u, v) to the graph */  
 30    public boolean addEdge(int u, int v);
 31  
 32    /** Add an edge to the graph */  
 33    public boolean addEdge(Edge e);
 34  
 35    /** Remove a vertex v from the graph, return true if successful */  
 36    public boolean remove(V v);
 37  
 38    /** Remove an edge (u, v) from the graph */  
 39    public boolean remove(int u, int v);
 40    
 41    /** Obtain a depth-first search tree */
 42    public UnweightedGraph<V>.SearchTree dfs(int v);
 43  
 44    /** Obtain a breadth-first search tree */
 45    public UnweightedGraph<V>.SearchTree bfs(int v);
 46  }