net.datastructures
Class ConnectivityDFS
java.lang.Object
net.datastructures.DFS
net.datastructures.ConnectivityDFS
- public class ConnectivityDFS
- extends DFS
This class specializes DFS to determine whether the graph is connected.
Field Summary |
protected int |
reached
|
Methods inherited from class net.datastructures.DFS |
dfsTraversal, finishVisit, init, initResult, isDone, isVisited, result, traverseBack, traverseDiscovery, unVisit, visit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
reached
protected int reached
ConnectivityDFS
public ConnectivityDFS()
execute
public Object execute(Graph g,
Vertex start,
Object info)
- Executes the DFS algorithm.
- Specified by:
execute
in class DFS
- Parameters:
g
- Input graphstart
- Start vertexinfo
- unused variable (can be anything)
- Returns:
Boolean
with value true if the graph is
connected, false otherwise
startVisit
protected void startVisit(Vertex v)
- Description copied from class:
DFS
- Called when we encounter a vertex (v).
- Overrides:
startVisit
in class DFS