All Packages Class Hierarchy This Package Previous Next Index
Class jdsl.core.algo.graphtraversals.DFS
java.lang.Object
|
+----jdsl.core.algo.graphtraversals.DFS
- public abstract class DFS
- extends Object
A template method implementation of a depth first search. A subclass
should override various methods to add functionality to this traversal.
-
graph
- The graph being traversed.
-
markedEdges
- A table of marked edges.
-
markedVerts
- A table of marked vertices.
-
visitResult
- The result of the traversal.
-
DFS()
-
-
dfsVisit(Vertex)
- Performs a recursive depth-first search starting at
v
-
execute(InspectableGraph, Vertex, Object)
- Runs the depth first search algorithm on a graph.
-
finishVisit(Vertex)
- Called when the search has finished with the vertex.
-
initResult()
- Initializes the result.
-
isDone()
- Tests if the depth first search is done.
-
isMarked(Edge)
- Tests if an edge has been marked.
-
isMarked(Vertex)
- Tests if a vertex has been marked.
-
mark(Edge)
- Marks an edge as traversed.
-
mark(Vertex)
- Called when a vertex needs to be marked as visited.
-
result()
- Returns the result of the search.
-
startVisit(Vertex)
- Called when a vertex is visited.
-
traverseBack(Edge, Vertex)
- Called when a back edge is traversed.
-
traverseDiscovery(Edge, Vertex)
- Called when a discovery edge is traversed.
graph
protected InspectableGraph graph
- The graph being traversed.
visitResult
protected Object visitResult
- The result of the traversal.
markedVerts
protected Hashtable markedVerts
- A table of marked vertices.
markedEdges
protected Hashtable markedEdges
- A table of marked edges.
DFS
public DFS()
execute
public Object execute(InspectableGraph g,
Vertex start,
Object info)
- Runs the depth first search algorithm on a graph.
- Parameters:
- g - An
InspectableGraph
on which to run a depth first
search.
- start - The
Vertex
at which to start the depth first
search.
- info - any extra information that the subclass might need.
dfsVisit
protected Object dfsVisit(Vertex v)
- Performs a recursive depth-first search starting at
v
mark
protected void mark(Vertex v)
- Called when a vertex needs to be marked as visited.
mark
protected void mark(Edge e)
- Marks an edge as traversed.
isMarked
protected boolean isMarked(Vertex v)
- Tests if a vertex has been marked.
isMarked
protected boolean isMarked(Edge e)
- Tests if an edge has been marked.
initResult
protected void initResult()
- Initializes the result. Should be overridden by a subclass.
startVisit
protected void startVisit(Vertex v)
- Called when a vertex is visited. Should be overridden by a subclass.
traverseDiscovery
protected void traverseDiscovery(Edge e,
Vertex from)
- Called when a discovery edge is traversed. Should be overridden by a
subclass.
traverseBack
protected void traverseBack(Edge e,
Vertex from)
- Called when a back edge is traversed. Should be overridden by a
subclass.
isDone
protected boolean isDone()
- Tests if the depth first search is done. Should be overridden by a
subclass.
finishVisit
protected void finishVisit(Vertex v)
- Called when the search has finished with the vertex. Should be
overridden by a subclass.
result
protected Object result()
- Returns the result of the search. Should be overridden by a subclass.
All Packages Class Hierarchy This Package Previous Next Index