jdsl.core.api
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.
- Author:
- Mike Boilen (mgb)
numVertices
public int numVertices()
- Returns:
- the number of vertices
numEdges
public int numEdges()
- Returns:
- the number of edges
vertices
public java.util.Enumeration vertices()
- Returns:
- an enumeration over the vertices
edges
public java.util.Enumeration edges()
- Returns:
- an enumeration over the edges
directedEdges
public java.util.Enumeration directedEdges()
- Returns:
- an enumeration over the directed edges
undirectedEdges
public java.util.Enumeration undirectedEdges()
- Returns:
- an enumeration 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.Enumeration 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 enumeration over all vertices adjacent to v
inAdjacentVertices
public java.util.Enumeration inAdjacentVertices(Vertex v)
throws InvalidPositionException
- Parameters:
v - a vertex- Returns:
- an enumeration over the vertices adjacent to v by incoming edges
outAdjacentVertices
public java.util.Enumeration outAdjacentVertices(Vertex v)
throws InvalidPositionException
- Parameters:
v - a vertex- Returns:
- an enumeration over the vertices adjacent to v by outgoing edges
incidentEdges
public java.util.Enumeration incidentEdges(Vertex v)
throws InvalidPositionException
- Parameters:
v - a vertex- Returns:
- an enumeration over all edges incident with v
inIncidentEdges
public java.util.Enumeration inIncidentEdges(Vertex v)
throws InvalidPositionException
- Parameters:
v - a vertex- Returns:
- an enumeration over the incoming edges of v
outIncidentEdges
public java.util.Enumeration outIncidentEdges(Vertex v)
throws InvalidPositionException
- Parameters:
v - a vertex- Returns:
- an enumeration over the outgoing edges of v
endVertices
public Vertex[] endVertices(Edge e)
throws InvalidPositionException
- Parameters:
e - an edge- Returns:
- an enumeration over the two endvertices of e
opposite
public Vertex opposite(Vertex v,
Edge e)
throws InvalidEdgeException,
InvalidPositionException
- Parameters:
e - an edgev - 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