|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.algo.Dfs
Framework class for depth first search (DFS) based algorithms. To write graph algorithms that are based on a depth first search one can extend this class and overwrite appropriate callback methods provided by this class.
Field Summary | |
protected static Object |
BLACK
Node state specifier. |
protected static Object |
GRAY
Node state specifier. |
protected NodeMap |
stateMap
NodeMap that indicates the state of the nodes as they are visited by this algorithm. |
protected static Object |
WHITE
Node state specifier. |
Constructor Summary | |
Dfs()
Instantiates a new Dfs object. |
Method Summary | |
protected void |
lookFurther(Node v)
Callback method that will be invoked whenever dfs continues its search at a new root node. |
protected void |
postTraverse(Edge edge,
Node node)
Callback method that will be invoked after the search returns from the given node. |
protected void |
postVisit(Node node,
int dfsNumber,
int compNumber)
Callback method that will be invoked whenever a node visit has been completed. |
protected void |
preTraverse(Edge edge,
Node node,
boolean treeEdge)
Callback method that will be invoked if the given edge will be looked at in the search the first (and only) time. |
protected void |
preVisit(Node node,
int dfsNumber)
Callback method that will be invoked whenever a formerly unvisited node gets visited the first time. |
void |
setDirectedMode(boolean directed)
Whether or not to interpret the edges of the graph as directed. |
void |
setLookFurtherMode(boolean lookFurther)
Whether or not to continue the depth first search after all nodes reachable from the first node were visited. |
void |
start(Graph graph)
Starts a depth first search on the given graph. |
void |
start(Graph graph,
Node start)
Starts a depth first search on the given graph. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected NodeMap stateMap
WHITE
, GRAY
and BLACK
.
protected static final Object WHITE
protected static final Object GRAY
protected static final Object BLACK
Constructor Detail |
public Dfs()
Method Detail |
public void setDirectedMode(boolean directed)
By default directed mode is disabled.
public void setLookFurtherMode(boolean lookFurther)
By default look further mode is active.
public void start(Graph graph)
public void start(Graph graph, Node start)
protected void preVisit(Node node, int dfsNumber)
By default this method does nothing
protected void postVisit(Node node, int dfsNumber, int compNumber)
protected void preTraverse(Edge edge, Node node, boolean treeEdge)
The given node is the node that will be visited next iff
treeEdge == true
.
By default this method does nothing
protected void postTraverse(Edge edge, Node node)
protected void lookFurther(Node v)
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |