public interface UndirectedGraph { /** * @return the number of vertices plus number of edges */ public int size(); /** * @return true iff the graph has no edges and no vertices */ public boolean isEmpty(); /** * @return the number of vertices */ public int numVertices(); /** * @return the number of edges */ public int numEdges(); /** * @return an enumeration over the vertices */ public Enumeration vertices(); /** * @return an enumeration over the edges */ public Enumeration edges(); /** * @param v a vertex * @return the number of (undirected) edges incident with v */ public int degree (Vertex v) throws InvalidPositionException; /** * @param v a vertex * @return an enumeration over all vertices adjacent to v */ public Enumeration adjacentVertices (Vertex v) throws InvalidPositionException; /** * @param v a vertex * @return an enumeration over all edges incident with v */ public Enumeration incidentEdges (Vertex v) throws InvalidPositionException; /** * @param e an edge * @return an enumeration over the two endvertices of e */ public Vertex[] endVertices (Edge e) throws InvalidPositionException; /** * @param e an edge * @param v one endvertex of e * @return the endvertex of e different from v * @throws InvalidEdgeException When v is not an endpoint of e */ public Vertex opposite (Vertex v, Edge e) throws InvalidEdgeException, InvalidPositionException; /** * Inserts a new isolated vertex containing an object. * @param info the object to be stored in the new vertex * @return the new vertex */ public Vertex insertVertex (Object info) throws InvalidPositionException; /** * Inserts a new undirected edge between two existing vertices. * @param u the first endvertex * @param v the second endvertex * @return the new edge */ public Edge insertEdge (Vertex u, Vertex v, Object info) throws InvalidPositionException; /** * Deletes a vertex and all its incident edges. If you need the locators * stored at the removed edges, get the locators beforehand.
* @param v the vertex to be deleted * @return Locator formerly stored at v */ public Object removeVertex (Vertex v) throws InvalidPositionException; /** * Removes an edge. * @param e the edge to be removed * @return The removed edge's element */ public Object removeEdge (Edge e) throws InvalidPositionException; }