|
net.datastructures - version 3.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.datastructures.DFS
net.datastructures.FindCycleDFS
A specialization of a generic DFS used to find a cycle in a graph.
| Field Summary | |
protected List |
cycle
|
protected Vertex |
cycleStart
|
protected boolean |
done
|
| Fields inherited from class net.datastructures.DFS |
G, STATUS, UNVISITED, VISITED, visitResult |
| Constructor Summary | |
FindCycleDFS()
|
|
| Method Summary | |
Object |
execute(Graph g,
Vertex start,
Object info)
Executes the DFS algorithm. |
protected void |
finishVisit(Vertex v)
Called after we finish the visit for a vertex (v). |
protected boolean |
isDone()
Determines whether the traversal is done early. |
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). |
| Methods inherited from class net.datastructures.DFS |
dfsTraversal, init, initResult, isVisited, result, unVisit, visit |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected List cycle
protected boolean done
protected Vertex cycleStart
| Constructor Detail |
public FindCycleDFS()
| Method Detail |
public Object execute(Graph g,
Vertex start,
Object info)
execute in class DFSg - Input graphstart - Start vertexinfo - Unused variable (can be anything)
Iterator containing an alternating sequence of
vertices and edges starting and ending with the same vertex, or
an empty iterator if the graph contains no cycles.protected void startVisit(Vertex v)
DFS
startVisit in class DFSprotected void finishVisit(Vertex v)
DFS
finishVisit in class DFS
protected void traverseDiscovery(Edge e,
Vertex from)
DFS
traverseDiscovery in class DFS
protected void traverseBack(Edge e,
Vertex from)
DFS
traverseBack in class DFSprotected boolean isDone()
DFS
isDone in class DFS
|
net.datastructures - version 3.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||