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 String |
edgeString(T from,
T to) |
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 |
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() |
protected String |
nodeString(T n,
boolean forEdge) |
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) |
Stream<T> |
stream() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected abstract NodeManager<T> getNodeManager()
protected abstract EdgeManager<T> getEdgeManager()
public Stream<T> stream()
stream in interface NodeManager<T>Stream of the nodes in this graphpublic Iterator<T> iterator()
iterator in interface NodeManager<T>iterator in interface Iterable<T>Iterator of the nodes in this graphNodeManager.iterator()public int getNumberOfNodes()
getNumberOfNodes in interface NodeManager<T>NodeManager.getNumberOfNodes()public int getPredNodeCount(T n) throws IllegalArgumentException
EdgeManagerimmediate predecessor nodes of ngetPredNodeCount in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.getPredNodeCount(java.lang.Object)public Iterator<T> getPredNodes(T n) throws IllegalArgumentException
EdgeManagerIterator 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.IllegalArgumentExceptionEdgeManager.getPredNodes(java.lang.Object)public int getSuccNodeCount(T n) throws IllegalArgumentException
EdgeManagerimmediate successor nodes of this Node in the GraphgetSuccNodeCount in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.getSuccNodeCount(java.lang.Object)public Iterator<T> getSuccNodes(T n) throws IllegalArgumentException
EdgeManagerThis method never returns null.
getSuccNodes in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.getSuccNodes(java.lang.Object)public void addNode(T n)
NodeManageraddNode in interface NodeManager<T>NodeManager.addNode(Object)public void addEdge(T src, T dst) throws IllegalArgumentException
addEdge in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.addEdge(Object, Object)public void removeEdge(T src, T dst) throws IllegalArgumentException
removeEdge in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.removeEdge(java.lang.Object, java.lang.Object)public boolean hasEdge(T src, T dst)
hasEdge in interface EdgeManager<T>EdgeManager.hasEdge(java.lang.Object, java.lang.Object)public void removeAllIncidentEdges(T node) throws IllegalArgumentException
removeAllIncidentEdges in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.removeAllIncidentEdges(Object)public void removeIncomingEdges(T node) throws IllegalArgumentException
removeIncomingEdges in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.removeAllIncidentEdges(Object)public void removeOutgoingEdges(T node) throws IllegalArgumentException
removeOutgoingEdges in interface EdgeManager<T>IllegalArgumentExceptionEdgeManager.removeAllIncidentEdges(Object)public void removeNodeAndEdges(T N) throws IllegalArgumentException
GraphremoveNodeAndEdges in interface Graph<T>IllegalArgumentExceptionNodeManager.removeNode(Object)public void removeNode(T n) throws IllegalArgumentException
NodeManagerremoveNode in interface NodeManager<T>IllegalArgumentExceptionNodeManager.removeNode(Object)public boolean containsNode(T n)
containsNode in interface NodeManager<T>NodeManager.containsNode(Object)