All Packages Class Hierarchy This Package Previous Next Index
Class jdsl.core.ref.SILGraph
java.lang.Object
|
+----jdsl.core.ref.SILGraph
- public class SILGraph
- extends Object
- implements Graph
This is the teach simplification/modification of the advanced Simple
Incidence List Graph.
- Version:
- $Revision: 1.4 $, $Date: 1998/07/13 20:03:49 $
- Author:
- Benoit Hudson (bh),Ryan Shaun Baker (rsb),Mike Boilen (mgb)
-
SILGraph()
- Constructs a new, empty Graph.
-
adjacentVertices(Vertex)
- Gets the adjacent vertices to a particular vertex.
-
degree(Vertex)
- Gets the number of incident edges of a vertex.
-
destination(Edge)
- Gets the destination of an edge.
-
directedEdges()
- Gets all the directedEdges in this graph.
-
edges()
- Gets all the edges in this graph.
-
elements()
- Gets the elements in this graph.
-
endVertices(Edge)
- Gets the endpoints of an edge.
-
inAdjacentVertices(Vertex)
- Gets all the vertices that are the source of an incoming incident edge
to a vertex.
-
incidentEdges(Vertex)
- Returns all edges incident to a particular vertex.
-
inDegree(Vertex)
- Gets the number of incoming incident edges of a vertex.
-
inIncidentEdges(Vertex)
- Returns all edges incident to a particular vertex.
-
insertDirectedEdge(Vertex, Vertex, Object)
- Inserts a directed edge into this graph.
-
insertEdge(Vertex, Vertex, Object)
- Inserts an edge into this graph.
-
insertVertex(Object)
- Inserts a vertex into this graph.
-
isDirected(Edge)
- Tests if an edge is directed.
-
isEmpty()
- Tests if this container is empty.
-
makeUndirected(Edge)
- Makes a directed edge undirected.
-
newContainer()
- Constructs a new, empty Graph.
-
numEdges()
- Gets the number of edges in this graph.
-
numVertices()
- Gets the number of vertices in this graph.
-
opposite(Vertex, Edge)
- Gets the end vertex of
Edge e
that is different from
Vertex v
.
-
origin(Edge)
- Gets the origin of an edge.
-
outAdjacentVertices(Vertex)
- Gets all the vertices that are the destination of an outgoing incident
edge to a vertex.
-
outDegree(Vertex)
- Gets the number of outgoing incident edges of a vertex.
-
outIncidentEdges(Vertex)
- Gets all edges incident from a particular vertex.
-
positions()
- Gets all the positions in this graph.
-
removeEdge(Edge)
- Removes an edge from this graph.
-
removeVertex(Vertex)
- Removes a vertex from this graph.
-
replace(Position, Object)
- Replaces the object associated with a position.
-
reverseDirection(Edge)
- Reverses the direction of an edge.
-
setDirectionFrom(Edge, Vertex)
- Sets the direction of an edge away from a vertex.
-
setDirectionTo(Edge, Vertex)
- Sets the direction of an edge to a vertex.
-
size()
- Gets the size of this graph.
-
swap(Position, Position)
- Swaps the elements of two positions.
-
undirectedEdges()
- Gets all the undirected edges in this graph.
-
vertices()
- Gets all the vertices in this graph.
SILGraph
public SILGraph()
- Constructs a new, empty Graph.
newContainer
public Container newContainer()
- Constructs a new, empty Graph.
size
public int size()
- Gets the size of this graph.
- Returns:
- the size, which is the number of edges plus the number of
vertices.
isEmpty
public boolean isEmpty()
- Tests if this container is empty.
- Returns:
-
true
if this container contains no vertices or
edges, false
otherwise.
elements
public Enumeration elements()
- Gets the elements in this graph.
- Returns:
- The objects associated with the vertices in this graph.
- See Also:
- insertVertex, insertEdge
positions
public Enumeration positions()
- Gets all the positions in this graph.
- Returns:
- All of the edges and vertices in this graph.
replace
public Object replace(Position p,
Object newElement) throws InvalidPositionException
- Replaces the object associated with a position.
- Parameters:
- p - Any position in the graph.
- newElement - The new element to associate with the
Position
- Returns:
- The old object associated with
p
- Throws: InvalidPositionException
- if
p
is not compatible
with this container.
swap
public void swap(Position a,
Position b) throws InvalidPositionException
- Swaps the elements of two positions. The
Positions
stay in
place.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
numVertices
public int numVertices()
- Gets the number of vertices in this graph.
numEdges
public int numEdges()
- Gets the number of edges in this graph.
vertices
public Enumeration vertices()
- Gets all the vertices in this graph.
edges
public Enumeration edges()
- Gets all the edges in this graph.
directedEdges
public Enumeration directedEdges()
- Gets all the directedEdges in this graph.
undirectedEdges
public Enumeration undirectedEdges()
- Gets all the undirected edges in this graph.
degree
public int degree(Vertex v)
- Gets the number of incident edges of a vertex.
inDegree
public int inDegree(Vertex v)
- Gets the number of incoming incident edges of a vertex.
outDegree
public int outDegree(Vertex v)
- Gets the number of outgoing incident edges of a vertex.
adjacentVertices
public Enumeration adjacentVertices(Vertex v) throws InvalidPositionException
- Gets the adjacent vertices to a particular vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
inAdjacentVertices
public Enumeration inAdjacentVertices(Vertex v) throws InvalidPositionException
- Gets all the vertices that are the source of an incoming incident edge
to a vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
outAdjacentVertices
public Enumeration outAdjacentVertices(Vertex v) throws InvalidPositionException
- Gets all the vertices that are the destination of an outgoing incident
edge to a vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
incidentEdges
public Enumeration incidentEdges(Vertex v) throws InvalidPositionException
- Returns all edges incident to a particular vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
inIncidentEdges
public Enumeration inIncidentEdges(Vertex v) throws InvalidPositionException
- Returns all edges incident to a particular vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
outIncidentEdges
public Enumeration outIncidentEdges(Vertex v) throws InvalidPositionException
- Gets all edges incident from a particular vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
endVertices
public Vertex[] endVertices(Edge e) throws InvalidPositionException
- Gets the endpoints of an edge.
- Throws: InvalidPositionException
- if the edge is invalid or
incompatible with this
Graph
opposite
public Vertex opposite(Vertex v,
Edge e) throws InvalidEdgeException, InvalidPositionException
- Gets the end vertex of
Edge e
that is different from
Vertex v
. If Edge e
is a self loop (both
oritin and destination are the same vertex), then v will be
returned.
- Parameters:
- e - Any edge in the graph.
- v - A vertex of
e
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
origin
public Vertex origin(Edge e) throws InvalidEdgeException, InvalidPositionException
- Gets the origin of an edge.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
destination
public Vertex destination(Edge e) throws InvalidEdgeException, InvalidPositionException
- Gets the destination of an edge.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
isDirected
public boolean isDirected(Edge e) throws InvalidEdgeException
- Tests if an edge is directed.
- Returns:
-
true
if the edge is directed, false
otherwise.
insertVertex
public Vertex insertVertex(Object info) throws InvalidPositionException
- Inserts a vertex into this graph.
- Parameters:
- info - Any
Object
to be associated with this vertex.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
insertEdge
public Edge insertEdge(Vertex v1,
Vertex v2,
Object elt) throws InvalidPositionException
- Inserts an edge into this graph.
- Parameters:
- v1 - An endpoint of the edge.
- v2 - An endpoint of the edge.
- elt - Any
Object
to be associated with this edge.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
insertDirectedEdge
public Edge insertDirectedEdge(Vertex v1,
Vertex v2,
Object elt) throws InvalidPositionException
- Inserts a directed edge into this graph.
- Parameters:
- v1 - The source of edge
- v2 - The destination of the ege
- elt - Any
Object
to be associated with this edge.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
removeVertex
public Object removeVertex(Vertex v) throws InvalidPositionException
- Removes a vertex from this graph. Removes all edges incident on and
incident from
v
.
- Parameters:
- v - The vertex to remove.
- Returns:
- The
Object
associated with v
.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
removeEdge
public Object removeEdge(Edge e) throws InvalidPositionException
- Removes an edge from this graph.
- Parameters:
- e - The edge to remove.
- Returns:
- the
Object
associated with the edge.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
setDirectionFrom
public void setDirectionFrom(Edge e,
Vertex newOrigin) throws InvalidEdgeException, InvalidPositionException
- Sets the direction of an edge away from a vertex.
- Parameters:
- e - The edge to change.
- newOrigin - a vertex of
e
, now the new origion of
e
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
setDirectionTo
public void setDirectionTo(Edge e,
Vertex newDestination) throws InvalidEdgeException, InvalidPositionException
- Sets the direction of an edge to a vertex.
- Parameters:
- e - The edge to change.
- newDestination - a vertex of
e
, now the new
destination of e
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
makeUndirected
public void makeUndirected(Edge e) throws InvalidEdgeException
- Makes a directed edge undirected.
reverseDirection
public void reverseDirection(Edge e) throws InvalidEdgeException, InvalidPositionException
- Reverses the direction of an edge.
- Throws: InvalidPositionException
- if the vertex is invalid or
incompatible with this
Graph
- Throws: InvalidEdgeException
- if e is not directed
All Packages Class Hierarchy This Package Previous Next Index