|
datastructures | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datastructures.DFS
Generic depth first search traversal of a graph using the template method pattern. A subclass should override various methods to add functionality.
Field Summary | |
protected Graph |
G
|
protected static Object |
STATUS
|
protected static Object |
UNVISITED
|
protected static Object |
VISITED
|
protected Object |
visitResult
|
Constructor Summary | |
DFS()
|
Method Summary | |
protected Object |
dfsTraversal(Vertex v)
Recursive template method for a generic DFS traversal. |
abstract Object |
execute(Graph g,
Vertex start,
Object info)
Execute a depth first search traversal on graph g, starting from a vertex v, optionally passing in an information object (info) |
protected void |
finishVisit(Vertex v)
Called after we finish the visit for a vertex (v). |
protected void |
init(Graph g)
Initialize the graph g for a traversal. |
protected void |
initResult()
Initializes result (called first, once per vertex visited). |
protected boolean |
isDone()
Determines whether the traversal is done early. |
protected boolean |
isVisited(DecorablePosition p)
Test if a position has been visited. |
protected Object |
result()
Returns a result of a visit (if needed). |
protected void |
startVisit(Vertex v)
Called when we encounter a vertex (v). |
protected void |
traverseBack(Edge e,
Vertex from)
Called when we traverse a back edge (e) from a vertex (from). |
protected void |
traverseDiscovery(Edge e,
Vertex from)
Called when we traverse a discovery edge (e) from a vertex (from). |
protected void |
unVisit(DecorablePosition p)
Mark a position as unvisited. |
protected void |
visit(DecorablePosition p)
Mark a position as visited. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Graph G
protected Object visitResult
protected static Object STATUS
protected static Object VISITED
protected static Object UNVISITED
Constructor Detail |
public DFS()
Method Detail |
public abstract Object execute(Graph g, Vertex start, Object info)
g
- Input graph.start
- Start vertex of the traversal.info
- Auxiliary information (to be used by subclasses).protected void init(Graph g)
protected Object dfsTraversal(Vertex v)
v
- Start vertex of the traversal
protected void visit(DecorablePosition p)
protected void unVisit(DecorablePosition p)
protected boolean isVisited(DecorablePosition p)
protected void initResult()
protected void startVisit(Vertex v)
protected void finishVisit(Vertex v)
protected void traverseDiscovery(Edge e, Vertex from)
protected void traverseBack(Edge e, Vertex from)
protected boolean isDone()
protected Object result()
|
datastructures | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |