public class DFSenumerateByFinish extends Stack<GraphNode> implements Enumeration<GraphNode>
Modifier and Type | Field and Description |
---|---|
GraphNode |
currentRoot
While a depth-first enumeration is in progress, this field
holds the current root node, i.e. the current bottom of the
search stack (assuming stacks grow upward).
|
private Enumeration<GraphNode> |
e
an enumeration of all nodes to search from
|
private List<Enumeration<GraphNode>> |
info
an enumeration of child nodes for each node being searched
|
private GraphNode |
theNextElement
the current next element in finishing time order
|
Modifier | Constructor and Description |
---|---|
protected |
DFSenumerateByFinish(Graph net)
Construct a depth-first enumerator across all the nodes of a
graph.
|
|
DFSenumerateByFinish(Graph net,
Enumeration<GraphNode> nodes)
Construct a depth-first enumerator across the (possibly
improper) subset of nodes reachable from the nodes in the given
enumeration.
|
Modifier and Type | Method and Description |
---|---|
protected Enumeration<GraphNode> |
getConnected(GraphNode n)
get the out edges of a given node
|
boolean |
hasMoreElements()
Return whether there are any more nodes left to enumerate.
|
GraphNode |
nextElement()
Find the next graph node in finishing time order.
|
compare, copy, empty, getTOS, isEmpty, iterator, peek, pop, push, shallowCopy, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public GraphNode currentRoot
private GraphNode theNextElement
private final Enumeration<GraphNode> e
private final List<Enumeration<GraphNode>> info
protected DFSenumerateByFinish(Graph net)
net
- the graph whose nodes to enumeratepublic DFSenumerateByFinish(Graph net, Enumeration<GraphNode> nodes)
net
- the graph whose nodes to enumeratenodes
- the set of nodes from which to start searchingpublic boolean hasMoreElements()
hasMoreElements
in interface Enumeration<GraphNode>
public GraphNode nextElement()
nextElement
in interface Enumeration<GraphNode>
nextElement()
protected Enumeration<GraphNode> getConnected(GraphNode n)
n
- the node of which to get the out edges