|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
An interface for Graphs.
Method Summary | |
---|---|
void |
add(Vertex v)
Adds a Vertex into the Graph. |
void |
addEdge(Edge e)
Adds an Edge into the Graph. |
Edge |
addEdge(Vertex v1,
Vertex v2)
Adds an Edge into the Graph. |
void |
addGraphAddEdgeListener(GraphAddEdgeListener listener)
Adds a GraphAddEdgeListener to the Graph's internal Vector of GraphAddEdgeListeners so that when a new Edge is added, all registered GraphAddEdgeListeners are notified of the event. |
void |
addGraphAddVertexListener(GraphAddVertexListener listener)
Adds a GraphAddVertexListener to the Graph's internal Vector of GraphAddVertexListeners so that when a new Vertex is added, all registered GraphAddVertedListeners are notified of the event. |
void |
addGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
Adds a GraphRemoveEdgeListener to the Graph's internal Vector of GraphRemoveEdgeListeners so that when an Edge is removed, all registered GraphRemoveEdgeListeners are notified of the event. |
void |
addGraphRemoveVertexListener(GraphRemoveVertexListener listener)
Adds a GraphRemoveVertexListener to the Graph's internal Vector of GraphRemoveVertexListeners so that when a Vertex is removed, all registered GraphRemoveVertexListeners are notified of the event. |
java.util.Collection |
cloneVertices()
Returns a clone of the Vector of vertices. |
Edge |
createEdge(Vertex v1,
Vertex v2)
Method to create the proper type of Edge class. |
java.util.Collection |
getAdjacentVertices(java.util.Collection vertices)
Returns the vertices adjacent to all the vertices in the given collection. |
java.util.Collection |
getAdjacentVertices(Vertex v)
Returns the vertices adjacent to the specified vertex. |
java.util.Collection |
getConnectedSet()
Returns the connected sets in the Graph. |
java.util.Collection |
getConnectedSet(Vertex v)
Returns the connected set to which the specified vertex belongs. |
int |
getDegree()
Returns the degree of the graph, which is simply the highest degree of all the graph's vertices. |
int |
getDegree(Vertex v)
Returns the degree of the vertex, which is simply the number of edges of the vertex. |
java.util.Collection |
getEdges(Vertex v)
Returns a Vector of edges of the specified vertex. |
GraphTraversal |
getTraversal()
Gets the traversal algorithm used by the Graph. |
java.util.Set |
getVertices(int degree)
Returns all vertices with the specified degree. |
int |
getVerticesCount()
Returns the number of vertices in the graph |
java.util.Iterator |
getVerticesIterator()
Returns an iterator that iterates through the graph's vertices. |
boolean |
isConnected(Vertex v1,
Vertex v2)
Determines if two vertices are connected |
void |
mergeconnectedSet(Vertex v1,
Vertex v2)
Merges the connected sets to which Vertex v1 and Vertex v2 belongs, if they are not yet connected. |
void |
remove(Vertex v)
Removes the specified Edge from the Graph. |
void |
removeEdge(Edge e)
Removes the specified Edge from the Graph. |
void |
removeEdges(Vertex v)
Removes incident Edges of a Vertex. |
void |
removeGraphAddEdgeListener(GraphAddEdgeListener listener)
Removes a GraphAddEdgeListener from the Graph's internal Vector of GraphAddEdgeListeners. |
void |
removeGraphAddVertexListener(GraphAddVertexListener listener)
Removes a GraphAddVertexListener from the Graph's internal Vector of GraphAddVertexListeners. |
void |
removeGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
Removes a GraphRemoveEdgeListener from the Graph's internal Vector of GraphRemoveEdgeListeners. |
void |
removeGraphRemoveVertexListener(GraphRemoveVertexListener listener)
Removes a GraphRemoveVertexListener from the Graph's internal Vector of GraphRemoveVertexListeners. |
void |
setTraversal(GraphTraversal traversal)
Sets the graph traversal algorithm to be used |
java.util.Vector |
traverse(Vertex startat)
Traverses the Graph starting at startat Vertex by performing a depth-first traversal. |
Method Detail |
---|
int getVerticesCount()
void add(Vertex v) throws java.lang.Exception
v
- Vertex to be added to the Graph
java.lang.Exception
void remove(Vertex v) throws java.lang.Exception
edge
- The Edge object to be removed.
java.lang.Exception
java.util.Iterator getVerticesIterator()
java.util.Collection cloneVertices()
Edge createEdge(Vertex v1, Vertex v2)
v1
- One endpoint of the edgev2
- Other endpoint of the edgeEdge addEdge(Vertex v1, Vertex v2) throws java.lang.Exception
v1
- One endpoint of the edgev2
- Other endpoint of the edge
java.lang.Exception
void addEdge(Edge e) throws java.lang.Exception
In the event that any one of the vertices are not existing in the Graph, they are added to the Graph.
Note: It is the caller's responsibility to make sure that the type of Edge being added to the Graph matches the Graph. For example, only a DirectedEdge must be added to a DirectedGraph.
e
- The edge to be added to the Graph.
java.lang.Exception
void removeEdge(Edge e) throws java.lang.Exception
e
- The Edge object to be removed.
java.lang.Exception
void removeEdges(Vertex v) throws java.lang.Exception
v
- Vertex whose Edges are to be removed
java.lang.Exception
int getDegree()
int getDegree(Vertex v)
java.util.Set getVertices(int degree)
degree
- The degree of the vertex to be returned.
java.util.Collection getEdges(Vertex v)
v
- The vertex whose edges we want returned
java.util.Collection getAdjacentVertices(Vertex v)
v
- The Vertex you want to determine its adjacent vertices.
java.util.Collection getAdjacentVertices(java.util.Collection vertices)
vertices
- Vector of Vertex where each vertex in the returned Set
must be adjacent to.
java.util.Collection getConnectedSet()
java.util.Collection getConnectedSet(Vertex v)
v
- Vertex to which you want the connected set returned.
void mergeconnectedSet(Vertex v1, Vertex v2)
v1
- Vertex whose connected set you want merged
with the connected set of Vertex v2.v2
- Vertex whose connected set you want merged
with the connected set of Vertex v1.java.util.Vector traverse(Vertex startat)
startat
- The Vertex to which you want to start the traversal.GraphTraversal getTraversal()
void setTraversal(GraphTraversal traversal)
traversal
- A concrete implementation of the GraphTraversal object.boolean isConnected(Vertex v1, Vertex v2)
v1
- starting Vertex for the pathv2
- ending Vertex for the path
void addGraphAddVertexListener(GraphAddVertexListener listener)
listener
- GraphAddVertexListener you want registered
or be notified when a new Vertex is addedGraphAddVertexListener
,
removeGraphAddVertexListener( GraphAddVertexListener )
void addGraphAddEdgeListener(GraphAddEdgeListener listener)
listener
- GraphAddEdgeListener you want registered
or be notified when a new Edge is addedGraphAddEdgeListener
,
removeGraphAddEdgeListener( GraphAddEdgeListener )
void addGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
listener
- GraphRemoveEdgeListener you want registered
or be notified when an Edge is removedGraphRemoveEdgeListener
,
removeGraphRemoveEdgeListener( GraphRemoveEdgeListener )
void addGraphRemoveVertexListener(GraphRemoveVertexListener listener)
listener
- GraphRemoveVertexListener you want registered
or be notified when a Vertex is removedGraphRemoveVertexListener
,
removeGraphRemoveVertexListener( GraphRemoveVertexListener )
void removeGraphAddVertexListener(GraphAddVertexListener listener)
listener
- GraphAddVertexListener you no longer want registered
or be notified when a Vertex is addedGraphAddVertexListener
,
addGraphAddVertexListener( GraphAddVertexListener )
void removeGraphAddEdgeListener(GraphAddEdgeListener listener)
listener
- GraphAddEdgeListener you no longer want registered
or be notified when an Edge is addedGraphAddEdgeListener
,
addGraphAddEdgeListener( GraphAddEdgeListener )
void removeGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
listener
- GraphRemoveEdgeListener you no longer want registered
or be notified when an Edge is removedGraphRemoveEdgeListener
,
addGraphRemoveEdgeListener( GraphRemoveEdgeListener )
void removeGraphRemoveVertexListener(GraphRemoveVertexListener listener)
listener
- GraphRemoveVertexListener you no longer want registered
or be notified when a Vertex is removedGraphRemoveVertexListener
,
addGraphRemoveVertexListener( GraphRemoveVertexListener )
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |