jdsl
Interface InspectableGraph

All Known Subinterfaces:
Graph
All Known Implementing Classes:
AMSGraphTree

public abstract interface InspectableGraph
extends PositionalContainer

An interface describing a graph as a combinatorial object. Holds both directed and undirected edges.


Method Summary
 java.util.Iterator adjacentVertices(Vertex v)
          "Adjacent" here includes directed incoming edges, in addition to the more expected directed outgoing and undirected edges.
 int degree(Vertex v)
           
 Vertex destination(Edge e)
           
 java.util.Iterator directedEdges()
           
 java.util.Iterator edges()
           
 Vertex[] endVertices(Edge e)
           
 java.util.Iterator inAdjacentVertices(Vertex v)
           
 java.util.Iterator incidentEdges(Vertex v)
           
 int inDegree(Vertex v)
           
 java.util.Iterator inIncidentEdges(Vertex v)
           
 boolean isDirected(Edge e)
           
 int numEdges()
           
 int numVertices()
           
 Vertex opposite(Vertex v, Edge e)
           
 Vertex origin(Edge e)
           
 java.util.Iterator outAdjacentVertices(Vertex v)
           
 int outDegree(Vertex v)
           
 java.util.Iterator outIncidentEdges(Vertex v)
           
 java.util.Iterator undirectedEdges()
           
 java.util.Iterator vertices()
           
 
Methods inherited from interface jdsl.PositionalContainer
positions, replace, swap
 
Methods inherited from interface jdsl.Container
elements, isEmpty, newContainer, size
 

Method Detail

numVertices

public int numVertices()
Returns:
the number of vertices

numEdges

public int numEdges()
Returns:
the number of edges

vertices

public java.util.Iterator vertices()
Returns:
an iterator over the vertices

edges

public java.util.Iterator edges()
Returns:
an iterator over the edges

directedEdges

public java.util.Iterator directedEdges()
Returns:
an iterator over the directed edges

undirectedEdges

public java.util.Iterator undirectedEdges()
Returns:
an iterator over the undirected edges

degree

public int degree(Vertex v)
           throws InvalidPositionException
Parameters:
v - a vertex
Returns:
the number of edges (directed and undirected) incident with v

inDegree

public int inDegree(Vertex v)
             throws InvalidPositionException
Parameters:
v - a vertex
Returns:
the number of incoming edges of v

outDegree

public int outDegree(Vertex v)
              throws InvalidPositionException
Parameters:
v - a vertex
Returns:
the number of outgoing edges of v

adjacentVertices

public java.util.Iterator adjacentVertices(Vertex v)
                                    throws InvalidPositionException
"Adjacent" here includes directed incoming edges, in addition to the more expected directed outgoing and undirected edges.

Parameters:
v - a vertex
Returns:
an iterator over all vertices adjacent to v

inAdjacentVertices

public java.util.Iterator inAdjacentVertices(Vertex v)
                                      throws InvalidPositionException
Parameters:
v - a vertex
Returns:
an iterator over the vertices adjacent to v by incoming edges

outAdjacentVertices

public java.util.Iterator outAdjacentVertices(Vertex v)
                                       throws InvalidPositionException
Parameters:
v - a vertex
Returns:
an iterator over the vertices adjacent to v by outgoing edges

incidentEdges

public java.util.Iterator incidentEdges(Vertex v)
                                 throws InvalidPositionException
Parameters:
v - a vertex
Returns:
an iterator over all edges incident with v

inIncidentEdges

public java.util.Iterator inIncidentEdges(Vertex v)
                                   throws InvalidPositionException
Parameters:
v - a vertex
Returns:
an iterator over the incoming edges of v

outIncidentEdges

public java.util.Iterator outIncidentEdges(Vertex v)
                                    throws InvalidPositionException
Parameters:
v - a vertex
Returns:
an iterator over the outgoing edges of v

endVertices

public Vertex[] endVertices(Edge e)
                     throws InvalidPositionException
Parameters:
e - an edge
Returns:
an iterator over the two endvertices of e

opposite

public Vertex opposite(Vertex v,
                       Edge e)
                throws InvalidEdgeException,
                       InvalidPositionException
Parameters:
e - an edge
v - one endvertex of e
Returns:
the endvertex of e different from v
Throws:
InvalidEdgeException - When v is not an endpoint of e

origin

public Vertex origin(Edge e)
              throws InvalidEdgeException,
                     InvalidPositionException
Parameters:
e - an edge
Returns:
the origin vertex of e, if e is directed
Throws:
InvalidEdgeException - When e is undirected

destination

public Vertex destination(Edge e)
                   throws InvalidEdgeException,
                          InvalidPositionException
Parameters:
e - an edge
Returns:
the destination vertex of e, if e is directed
Throws:
InvalidEdgeException - When e is undirected

isDirected

public boolean isDirected(Edge e)
                   throws InvalidEdgeException
Parameters:
e - an edge
Returns:
true if e is directed, false otherwise