public class HashReversibleGraph<N> extends HashMutableDirectedGraph<N> implements ReversibleGraph<N>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
reversed |
heads, nodeToPreds, nodeToSuccs, tails| Constructor and Description |
|---|
HashReversibleGraph() |
HashReversibleGraph(DirectedGraph<N> dg) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEdge(N from,
N to)
Adds an edge to the graph between 2 nodes.
|
boolean |
containsEdge(N from,
N to) |
java.util.List<N> |
getHeads()
Returns a list of entry points for this graph.
|
java.util.List<N> |
getPredsOf(N s)
Returns a list of predecessors for the given node in the graph.
|
java.util.List<N> |
getSuccsOf(N s)
Returns a list of successors for the given node in the graph.
|
java.util.List<N> |
getTails()
Returns a list of exit points for this graph.
|
boolean |
isReversed()
Returns true if the graph is now reversed from its original state
at creation.
|
void |
removeEdge(N from,
N to)
Removes an edge between 2 nodes in the graph.
|
ReversibleGraph<N> |
reverse()
Reverse the edges of the current graph and swap head and tail
nodes.
|
addNode, clearAll, clone, containsNode, getNodes, getPredsOfAsSet, getSuccsOfAsSet, iterator, printGraph, removeNode, sizeequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddNode, containsNode, getNodes, removeNodeiterator, sizepublic HashReversibleGraph(DirectedGraph<N> dg)
public HashReversibleGraph()
public boolean isReversed()
ReversibleGraphisReversed in interface ReversibleGraph<N>public ReversibleGraph<N> reverse()
ReversibleGraphreverse in interface ReversibleGraph<N>public void addEdge(N from, N to)
MutableDirectedGraphaddEdge in interface MutableDirectedGraph<N>addEdge in class HashMutableDirectedGraph<N>from - out node for the edge.to - in node for the edge.public void removeEdge(N from, N to)
MutableDirectedGraphremoveEdge in interface MutableDirectedGraph<N>removeEdge in class HashMutableDirectedGraph<N>from - out node for the edge to remove.to - in node for the edge to remove.public boolean containsEdge(N from, N to)
containsEdge in interface MutableDirectedGraph<N>containsEdge in class HashMutableDirectedGraph<N>public java.util.List<N> getHeads()
DirectedGraphgetHeads in interface DirectedGraph<N>getHeads in class HashMutableDirectedGraph<N>public java.util.List<N> getTails()
DirectedGraphgetTails in interface DirectedGraph<N>getTails in class HashMutableDirectedGraph<N>public java.util.List<N> getPredsOf(N s)
DirectedGraphgetPredsOf in interface DirectedGraph<N>getPredsOf in class HashMutableDirectedGraph<N>public java.util.List<N> getSuccsOf(N s)
DirectedGraphgetSuccsOf in interface DirectedGraph<N>getSuccsOf in class HashMutableDirectedGraph<N>