|
net.datastructures - version 5.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datastructures.DFS<V,E,I,R>
public class DFS<V,E,I,R>
Generic DFS traversal of a graph using the template method pattern. Parameterized types: V, the type for the elements stored at vertices E, the type for the elements stored at edges I, the type for the information object passed to the execute method R, the type for the result object returned by the DFS
Field Summary | |
---|---|
protected Graph<V,E> |
graph
|
protected I |
info
|
protected Vertex<V> |
start
|
protected static Object |
STATUS
|
protected static Object |
UNVISITED
|
protected static Object |
VISITED
|
protected R |
visitResult
|
Constructor Summary | |
---|---|
DFS()
|
Method Summary | |
---|---|
protected R |
dfsTraversal(Vertex<V> v)
Recursive template method for a generic DFS traversal. |
R |
execute(Graph<V,E> g,
Vertex<V> s,
I in)
Execute a depth first search traversal on graph g, starting from a start vertex s, passing in an information object (in) |
protected R |
finalResult(R r)
Returns the final result of the DFS execute method. |
protected void |
finishVisit(Vertex<V> v)
Called after we finish the visit for a vertex (v). |
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 (vertex or edge) has been visited. |
protected R |
result()
Returns a result of a visit (if needed). |
protected void |
setup()
Setup method that is called prior to the DFS execution. |
protected void |
startVisit(Vertex<V> v)
Called when we encounter a vertex (v). |
protected void |
traverseBack(Edge<E> e,
Vertex<V> from)
Called when we traverse a back edge (e) from a vertex (from). |
protected void |
traverseDiscovery(Edge<E> e,
Vertex<V> from)
Called when we traverse a discovery edge (e) from a vertex (from). |
protected void |
unVisit(DecorablePosition<?> p)
Mark a position (vertex or edge) as unvisited. |
protected void |
visit(DecorablePosition<?> p)
Mark a position (vertex or edge) as visited. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Graph<V,E> graph
protected Vertex<V> start
protected I info
protected R visitResult
protected static Object STATUS
protected static Object VISITED
protected static Object UNVISITED
Constructor Detail |
---|
public DFS()
Method Detail |
---|
public R execute(Graph<V,E> g, Vertex<V> s, I in)
protected R dfsTraversal(Vertex<V> v)
protected void visit(DecorablePosition<?> p)
protected void unVisit(DecorablePosition<?> p)
protected boolean isVisited(DecorablePosition<?> p)
protected void setup()
protected void initResult()
protected void startVisit(Vertex<V> v)
protected void finishVisit(Vertex<V> v)
protected void traverseDiscovery(Edge<E> e, Vertex<V> from)
protected void traverseBack(Edge<E> e, Vertex<V> from)
protected boolean isDone()
protected R result()
protected R finalResult(R r)
|
net.datastructures - version 5.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |