public abstract class AbstractGraph<T> extends Object implements Graph<T>
Graph
that delegates node and edge management.Constructor and Description |
---|
AbstractGraph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(T src,
T dst) |
void |
addNode(T n)
add a node to this graph
|
boolean |
containsNode(T n) |
protected abstract EdgeManager<T> |
getEdgeManager() |
protected abstract NodeManager<T> |
getNodeManager() |
int |
getNumberOfNodes() |
int |
getPredNodeCount(T n)
Return the number of
immediate predecessor nodes of n |
Iterator<T> |
getPredNodes(T n)
Return an
Iterator over the immediate predecessor nodes of n
This method never returns null . |
int |
getSuccNodeCount(T n)
Return the number of
immediate successor nodes of this Node in the Graph |
Iterator<T> |
getSuccNodes(T n)
Return an Iterator over the immediate successor nodes of n
|
boolean |
hasEdge(T src,
T dst) |
Iterator<T> |
iterator() |
void |
removeAllIncidentEdges(T node) |
void |
removeEdge(T src,
T dst) |
void |
removeIncomingEdges(T node) |
void |
removeNode(T n)
remove a node from this graph
|
void |
removeNodeAndEdges(T N)
remove a node and all its incident edges
|
void |
removeOutgoingEdges(T node) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected abstract NodeManager<T> getNodeManager()
protected abstract EdgeManager<T> getEdgeManager()
public int getNumberOfNodes()
getNumberOfNodes
in interface NodeManager<T>
public int getPredNodeCount(T n) throws IllegalArgumentException
EdgeManager
immediate predecessor
nodes of ngetPredNodeCount
in interface EdgeManager<T>
IllegalArgumentException
public Iterator<T> getPredNodes(T n) throws IllegalArgumentException
EdgeManager
Iterator
over the immediate predecessor nodes of n
This method never returns null
.getPredNodes
in interface EdgeManager<T>
Iterator
over the immediate predecessor nodes of this Node.IllegalArgumentException
public int getSuccNodeCount(T n) throws IllegalArgumentException
EdgeManager
immediate successor
nodes of this Node in the GraphgetSuccNodeCount
in interface EdgeManager<T>
IllegalArgumentException
public Iterator<T> getSuccNodes(T n) throws IllegalArgumentException
EdgeManager
This method never returns null
.
getSuccNodes
in interface EdgeManager<T>
IllegalArgumentException
public void addNode(T n)
NodeManager
addNode
in interface NodeManager<T>
public void addEdge(T src, T dst) throws IllegalArgumentException
addEdge
in interface EdgeManager<T>
IllegalArgumentException
public void removeEdge(T src, T dst) throws IllegalArgumentException
removeEdge
in interface EdgeManager<T>
IllegalArgumentException
public boolean hasEdge(T src, T dst)
hasEdge
in interface EdgeManager<T>
public void removeAllIncidentEdges(T node) throws IllegalArgumentException
removeAllIncidentEdges
in interface EdgeManager<T>
IllegalArgumentException
public void removeIncomingEdges(T node) throws IllegalArgumentException
removeIncomingEdges
in interface EdgeManager<T>
IllegalArgumentException
public void removeOutgoingEdges(T node) throws IllegalArgumentException
removeOutgoingEdges
in interface EdgeManager<T>
IllegalArgumentException
public void removeNodeAndEdges(T N) throws IllegalArgumentException
Graph
removeNodeAndEdges
in interface Graph<T>
IllegalArgumentException
public void removeNode(T n) throws IllegalArgumentException
NodeManager
removeNode
in interface NodeManager<T>
IllegalArgumentException
public boolean containsNode(T n)
containsNode
in interface NodeManager<T>