|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graph.algorithm.DFS
This class implements the Depth-First-Search (DFS) algorithm with a cost of
O(|V| + |E|).The visitor pattern is used for passing method pointers to the algorithm for specific algorithm uses.
| Constructor Summary | |
DFS()
Construct a new DFS object. |
|
| Method Summary | |
void |
apply(Graph graph,
DFSVisitor visitor)
Applies the DFS algorithm with an arbitrary starting node. |
void |
apply(Graph graph,
DFSVisitor visitor,
Node startnode)
Applies the DFS algorithm with the given starting node. |
int |
getDFSNumber(Node node)
Returns the DFS order number of a given node. |
Node |
getDFSParent(Node node)
Returns the parent of the node in the dfs forest or null. |
java.util.ArrayList |
getDFSSequence()
Returns a random-access list of the node-order obtained by the DFS. |
java.util.List |
getRoots()
Returns the roots of the trees in the DFS search forest. |
boolean |
isConnected()
Returns true if the graph is strongly connected |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DFS()
| Method Detail |
public boolean isConnected()
public java.util.List getRoots()
public java.util.ArrayList getDFSSequence()
public int getDFSNumber(Node node)
node - the node whose dfs number is retrieved.
public Node getDFSParent(Node node)
node - the node whose father is retrieved.
public void apply(Graph graph,
DFSVisitor visitor)
graph - the graph to search, may not be null.visitor - the dfsvisitor whose callbacks to invoke during
traversal, may not be null.
public void apply(Graph graph,
DFSVisitor visitor,
Node startnode)
graph - the graph to search, , may not be null.visitor - the dfsvisitor whose callbacks to invoke during
traversal, may not be null.startnode - the node where to start the depth first searching,
may be null.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||