public abstract class GraphDelegator extends Object implements Graph
| Modifier | Constructor and Description |
|---|---|
protected |
GraphDelegator(Graph graph) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Vertex v)
Adds a Vertex into the Graph.
|
void |
addEdge(Edge e)
Adds a previously-defined Edge into the Graph.
|
Edge |
addEdge(Vertex v1,
Vertex v2)
Creates an edge between two vertices and adds it into the Graph.
|
void |
addGraphAddEdgeListener(GraphAddEdgeListener listener)
Adds a GraphAddEdgeListener to the Graph's internal List 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 List 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 List 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 List of
GraphRemoveVertexListeners so that when a Vertex is removed,
all registered GraphRemoveVertexListeners are notified of the event.
|
void |
addListener(GraphListener listener)
Registers a GraphListener with this Graph.
|
List |
cloneVertices()
Returns a modifiable clone of the vertex set as a List in
arbitrary order.
|
Set |
getAdjacentVertices(List vertices)
Returns the vertices adjacent to all the vertices in the given collection.
|
List |
getAdjacentVertices(Vertex v)
Returns the vertices adjacent to the specified vertex.
|
Collection |
getConnectedSet()
Returns the connected sets in the Graph.
|
Set |
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.
|
List |
getEdges(Vertex v)
Returns a List of edges of the specified vertex.
|
int |
getEdgesCount()
Returns the number of edges in the graph
|
Set |
getEdgeSet()
Returns an unmodifiable set of the edges included in this graph.
|
protected Graph |
getGraph() |
GraphFactory |
getGraphFactory()
Returns the factory that will be responsible for creating Vertices
and Edges in a Graph.
|
GraphTraversal |
getTraversal()
Gets the traversal algorithm used by the Graph.
|
Set |
getVertexSet()
Returns an unmodifiable set of the vertices included in this graph.
|
Set |
getVertices(int degree)
Returns all vertices with the specified degree.
|
int |
getVerticesCount()
Returns the number of vertices in the graph
|
Iterator |
getVerticesIterator()
Returns an iterator that iterates through the graph's vertices in
arbitrary order.
|
boolean |
isConnected(Vertex v1,
Vertex v2)
Determines if two vertices are connected
|
void |
remove(Vertex v)
Removes the specified Vertex and all of its incident edges from the
Graph.
|
void |
removeEdge(Edge e)
Removes the specified Edge from the Graph, and notifies listeners.
|
void |
removeEdges(Vertex v)
Removes incident Edges of a Vertex.
|
void |
removeGraphAddEdgeListener(GraphAddEdgeListener listener)
Removes a GraphAddEdgeListener from the Graph's internal List of
GraphAddEdgeListeners.
|
void |
removeGraphAddVertexListener(GraphAddVertexListener listener)
Removes a GraphAddVertexListener from the Graph's internal List of
GraphAddVertexListeners.
|
void |
removeGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
Removes a GraphRemoveEdgeListener from the Graph's internal List of
GraphRemoveEdgeListeners.
|
void |
removeGraphRemoveVertexListener(GraphRemoveVertexListener listener)
Removes a GraphRemoveVertexListener from the Graph's internal List of
GraphRemoveVertexListeners.
|
void |
removeListener(GraphListener listener)
Unregisters a GraphListener currently attached to this Graph.
|
void |
setGraphFactory(GraphFactory factory)
Sets the factory that will be responsible for creating Vertices
and Edges in a Graph.
|
void |
setTraversal(GraphTraversal traversal)
Sets the graph traversal algorithm to be used
|
List |
traverse(Vertex startat)
Traverses the Graph starting at startat Vertex by performing a
depth-first traversal.
|
protected GraphDelegator(Graph graph)
protected final Graph getGraph()
public Set getVertexSet()
GraphgetVertexSet in interface Graphpublic Set getEdgeSet()
GraphgetEdgeSet in interface Graphpublic int getEdgesCount()
GraphgetEdgesCount in interface Graphpublic int getVerticesCount()
GraphgetVerticesCount in interface Graphpublic GraphFactory getGraphFactory()
GraphgetGraphFactory in interface Graphpublic void setGraphFactory(GraphFactory factory)
GraphsetGraphFactory in interface Graphpublic void add(Vertex v) throws Exception
Graphpublic void remove(Vertex v) throws Exception
Graphpublic Iterator getVerticesIterator()
GraphgetVerticesIterator in interface Graphpublic List cloneVertices()
GraphcloneVertices in interface Graphpublic Edge addEdge(Vertex v1, Vertex v2) throws Exception
Graphpublic void addEdge(Edge e) throws Exception
GraphNote: 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.
public void removeEdge(Edge e) throws Exception
GraphremoveEdge in interface Graphe - The Edge object to be removed.Exceptionpublic void removeEdges(Vertex v) throws Exception
GraphremoveEdges in interface Graphv - Vertex whose Edges are to be removedExceptionpublic int getDegree()
Graphpublic int getDegree(Vertex v)
Graphpublic Set getVertices(int degree)
GraphgetVertices in interface Graphdegree - The degree of the vertex to be returned.public List getEdges(Vertex v)
Graphpublic List getAdjacentVertices(Vertex v)
GraphgetAdjacentVertices in interface Graphv - The Vertex you want to determine its adjacent vertices.public Set getAdjacentVertices(List vertices)
GraphgetAdjacentVertices in interface Graphvertices - List of Vertex where each vertex in the returned Set
must be adjacent to.public Collection getConnectedSet()
GraphgetConnectedSet in interface Graphpublic Set getConnectedSet(Vertex v)
GraphgetConnectedSet in interface Graphv - Vertex to which you want the connected set returned.public List traverse(Vertex startat)
Graphpublic GraphTraversal getTraversal()
GraphgetTraversal in interface Graphpublic void setTraversal(GraphTraversal traversal)
GraphsetTraversal in interface Graphtraversal - A concrete implementation of the GraphTraversal object.public boolean isConnected(Vertex v1, Vertex v2)
GraphisConnected in interface Graphv1 - starting Vertex for the pathv2 - ending Vertex for the pathpublic void addListener(GraphListener listener)
GraphaddListener in interface Graphlistener - the listener being registered, which will receive
notifications of all graph modificationspublic void removeListener(GraphListener listener)
GraphremoveListener in interface Graphlistener - the listener being unregistered, which will
cease receiving notificationspublic void addGraphAddVertexListener(GraphAddVertexListener listener)
GraphaddGraphAddVertexListener in interface Graphlistener - GraphAddVertexListener you want registered
or be notified when a new Vertex is addedGraphAddVertexListener,
Graph.removeGraphAddVertexListener( GraphAddVertexListener ),
Graph.addListener(salvo.jesus.graph.GraphListener)public void addGraphAddEdgeListener(GraphAddEdgeListener listener)
GraphaddGraphAddEdgeListener in interface Graphlistener - GraphAddEdgeListener you want registered
or be notified when a new Edge is addedGraphAddEdgeListener,
Graph.removeGraphAddEdgeListener( GraphAddEdgeListener ),
Graph.addListener(salvo.jesus.graph.GraphListener)public void addGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
GraphaddGraphRemoveEdgeListener in interface Graphlistener - GraphRemoveEdgeListener you want registered
or be notified when an Edge is removedGraphRemoveEdgeListener,
Graph.removeGraphRemoveEdgeListener( GraphRemoveEdgeListener ),
Graph.addListener(salvo.jesus.graph.GraphListener)public void addGraphRemoveVertexListener(GraphRemoveVertexListener listener)
GraphaddGraphRemoveVertexListener in interface Graphlistener - GraphRemoveVertexListener you want registered
or be notified when a Vertex is removedGraphRemoveVertexListener,
Graph.removeGraphRemoveVertexListener( GraphRemoveVertexListener ),
Graph.addListener(salvo.jesus.graph.GraphListener)public void removeGraphAddVertexListener(GraphAddVertexListener listener)
GraphremoveGraphAddVertexListener in interface Graphlistener - GraphAddVertexListener you no longer want registered
or be notified when a Vertex is addedGraphAddVertexListener,
Graph.addGraphAddVertexListener( GraphAddVertexListener ),
Graph.removeListener(salvo.jesus.graph.GraphListener)public void removeGraphAddEdgeListener(GraphAddEdgeListener listener)
GraphremoveGraphAddEdgeListener in interface Graphlistener - GraphAddEdgeListener you no longer want registered
or be notified when an Edge is addedGraphAddEdgeListener,
Graph.addGraphAddEdgeListener( GraphAddEdgeListener ),
Graph.removeListener(salvo.jesus.graph.GraphListener)public void removeGraphRemoveEdgeListener(GraphRemoveEdgeListener listener)
GraphremoveGraphRemoveEdgeListener in interface Graphlistener - GraphRemoveEdgeListener you no longer want registered
or be notified when an Edge is removedGraphRemoveEdgeListener,
Graph.addGraphRemoveEdgeListener( GraphRemoveEdgeListener ),
Graph.removeListener(salvo.jesus.graph.GraphListener)public void removeGraphRemoveVertexListener(GraphRemoveVertexListener listener)
GraphremoveGraphRemoveVertexListener in interface Graphlistener - GraphRemoveVertexListener you no longer want registered
or be notified when a Vertex is removedGraphRemoveVertexListener,
Graph.addGraphRemoveVertexListener( GraphRemoveVertexListener ),
Graph.removeListener(salvo.jesus.graph.GraphListener)Copyright © 2019 JULIE Lab, Germany. All rights reserved.