Please send questions to st10@humboldt.edu .
/* Cs132Graph.java 1.2                                    */
/* by Sharon Tuttle                                       */
/* last modified: 5-02-03                                 */
/*                                                        */
/* an interface for a simple conceptual graph;            */
/* influenced somewhat by pp. 391-392, course text        */
/*                                                        */
/* latest modifications:                                  */
/* 5-1-03:                                                */
/*--------------------------------------------------------*/
/* reset() - a method to "clear" the visited-flags within */
/* the vertices of a graph, causing all vertices to be    */
/* marked as unvisited.                                   */
/*                                                        */
/* degree() - a method to return the number of vertices   */
/* adjacent to a given vertex                             */
/*                                                        */
/* adjacentVerts() - a method to return a list of the     */
/* vertices adjacent to a given vertex.                   */
/*                                                        */
/* 5-2-03:                                                */
/*--------------------------------------------------------*/
/* adjacentVerts() returns an array of Cs132Vertex        */
/* instances, instead of a Cs132List (to save copying     */
/* and pasting on HW #11... 8-) )                         */
/*                                                        */
/* addVertex() is now specified to throw                  */
/* GraphOverflowException (if adding new vertex fails     */
/* because maximum number of vertices was                 */
/* reached)                                               */

public interface Cs132Graph
{
  /*-----------------------------------------------------------------
     isEmpty()
     Purpose: return true if there are no vertices and no edges in the 
              graph, false otherwise.
    ---------------------------------------------------------------------*/
    public boolean isEmpty();


    /*-----------------------------------------------------------
     vertexCount()
     Purpose: return the number of vertices in this graph.
    -------------------------------------------------------------*/
    public int vertexCount();

    /*-----------------------------------------------------------
     edgeCount()
     Purpose: return the number of edges in this graph.
    -------------------------------------------------------------*/
    public int edgeCount();

    /*-----------------------------------------------------------
     containsEdge()
     Purpose: determine whether an edge exists between two given
              vertices v1 and v2 --- return true if so, false 
              otherwise.
    -------------------------------------------------------------*/
    public boolean containsEdge(Cs132Vertex v1, Cs132Vertex v2);

    /*------------------------------------------------------------
     addVertex()
     Purpose: add a vertex vert to the graph; it is expected that
              a vertex has a search key, and that it is unique to
              each vertex. So, if vert has the same search key as
              an existing vertex already in the graph, it should not
              be added to the graph.
    ---------------------------------------------------------------*/
    public void addVertex(Cs132Vertex vert) throws GraphOverflowException;

    /*---------------------------------------------------------------
     addEdge()
     Purpose: add an edge between the two given vertices v1 and v2 to
              the graph. (If such an edge already does exist, the graph
              should not change as a result of this action.)
    ------------------------------------------------------------------*/
    public void addEdge(Cs132Vertex v1, Cs132Vertex v2);
    
    /*-----------------------------------------------------------------
     removeVertex()
     Purpose: remove/delete the specified vertex vert from the graph,
              along with any edges between vert and other vertices.
    -------------------------------------------------------------------*/
    public void removeVertex(Cs132Vertex vert);

    /*--------------------------------------------------------------------
     removeEdge()
     Purpose: remove/delete the edge, if any, between vertices v1 and v2.
    ---------------------------------------------------------------------*/
    public void removeEdge(Cs132Vertex v1, Cs132Vertex v2);

    /*-------------------------------------------------------------
     getVertex()
     Purpose: gets the vertex with the specified search key from the
              graph. Returns null if there is no such vertex.

              (I decided to make search key comparable because,
              to be able to compare two keys, it seemed to be a 
              reasonable requirement...)
    ---------------------------------------------------------------*/
    public Cs132Vertex getVertex(Comparable key);


    /*-------------------------------------------------------------------
     clear()
     Purpose: removes all vertices from the graph (with the implication
              that, as they are removed, edges associated with them will
              be removed, also).
    ---------------------------------------------------------------------*/
    public void clear();
    
    /*----------------------------------------------------------------
     reset()
     Purpose: "clears" the visited-flags within the vertices
              of this graph, causing all vertices to be marked
              as unvisited.
    ------------------------------------------------------------------*/
    public void reset();
    
    /*----------------------------------------------------------------
     degree()
     Purpose: returns the number of vertices adjacent to the given
              vertex vert
    ------------------------------------------------------------------*/
    public int degree(Cs132Vertex vert);
    
    /*--------------------------------------------------
     adjacentVerts()
     Purpose: return an array containing the vertices adjacent
              to the given vertex vert
    ----------------------------------------------------*/
    public Cs132Vertex[] adjacentVerts (Cs132Vertex vert);
}