|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
The interface describing all Graph objects. Graphs are collections of vertices connected by a set of edges. Edges may or may not be directed. Portions of the graph may be marked visited to support iterative algorithms. Iteration is provided over vertices, edges, and vertices adjacent to a particular vertex
GraphList
,
GraphMatrix
Method Summary | |
---|---|
void |
add(java.lang.Object label)
Add a vertex to the graph |
void |
addEdge(java.lang.Object vtx1,
java.lang.Object vtx2,
java.lang.Object label)
Add an edge between two vertices within the graph. |
void |
clear()
Remove all vertices (and thus, edges) of the graph. |
boolean |
contains(java.lang.Object label)
Test for vertex membership. |
boolean |
containsEdge(java.lang.Object vLabel1,
java.lang.Object vLabel2)
Test for edge membership. |
int |
degree(java.lang.Object label)
Determine out degree of vertex. |
int |
edgeCount()
Determine the number of edges in graph. |
java.util.Iterator |
edges()
Construct an iterator over all edges. |
java.lang.Object |
get(java.lang.Object label)
Get reference to actual label of vertex. |
Edge |
getEdge(java.lang.Object label1,
java.lang.Object label2)
Get reference to actual edge. |
boolean |
isDirected()
Determine if graph is directed. |
boolean |
isEmpty()
Determine if graph is empty. |
boolean |
isVisited(java.lang.Object label)
Return visited flag of vertex. |
boolean |
isVisitedEdge(Edge e)
Return visited flag of edge. |
java.util.Iterator |
iterator()
Construct vertex iterator. |
java.util.Iterator |
neighbors(java.lang.Object label)
Construct an adjacent vertex iterator. |
java.lang.Object |
remove(java.lang.Object label)
Remove a vertex from the graph. |
java.lang.Object |
removeEdge(java.lang.Object vLabel1,
java.lang.Object vLabel2)
Remove possible edge between vertices labeled vLabel1 and vLabel2. |
void |
reset()
Clear visited flags of edges and vertices. |
int |
size()
Determine number of vertices within graph. |
boolean |
visit(java.lang.Object label)
Test and set visited flag of vertex |
boolean |
visitEdge(Edge e)
Test and set visited flag of edge. |
Methods inherited from interface structure.Structure |
---|
elements, values |
Method Detail |
---|
void add(java.lang.Object label)
add
in interface Structure
label
- Label of the vertex; should be non-nullvoid addEdge(java.lang.Object vtx1, java.lang.Object vtx2, java.lang.Object label)
vtx1
- First (or source, if directed) vertex.vtx2
- Second (or destination, if directed) vertex.label
- Label associated with the edge.java.lang.Object remove(java.lang.Object label)
remove
in interface Structure
label
- The label of the vertex within the graph.
java.lang.Object removeEdge(java.lang.Object vLabel1, java.lang.Object vLabel2)
vLabel1
- First (or source, if directed) vertex.vLabel2
- Second (or destination, if directed) vertex.
java.lang.Object get(java.lang.Object label)
label
- The label of the vertex sought.
Edge getEdge(java.lang.Object label1, java.lang.Object label2)
label1
- The first (or source, if directed) vertex.label2
- The second (or destination, if directed) vertex.
boolean contains(java.lang.Object label)
contains
in interface Structure
label
- The label of the vertex sought.
boolean containsEdge(java.lang.Object vLabel1, java.lang.Object vLabel2)
vLabel1
- First (or source, if directed) vertex.vLabel2
- Second (or destination, if directed) vertex.
boolean visit(java.lang.Object label)
label
- Label of vertex to be visited.
boolean visitEdge(Edge e)
e
- Edge object that is part of graph.
boolean isVisited(java.lang.Object label)
label
- Label of vertex.
boolean isVisitedEdge(Edge e)
e
- Edge of graph to be considered.
void reset()
int size()
size
in interface Structure
int degree(java.lang.Object label)
label
- Label associated with vertex.
int edgeCount()
java.util.Iterator iterator()
iterator
in interface Structure
AbstractIterator
,
Iterator
,
Enumeration
,
Structure.elements()
java.util.Iterator neighbors(java.lang.Object label)
label
- Label of the vertex.
java.util.Iterator edges()
void clear()
clear
in interface Structure
boolean isEmpty()
isEmpty
in interface Structure
boolean isDirected()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |