Class DepthFirstSearchTraversalStrategy<V,E>
- java.lang.Object
-
- science.aist.gtf.graph.impl.traversal.DepthFirstSearchTraversalStrategy<V,E>
-
- Type Parameters:
V
- the type of the decorated vertex valueE
- the type of the decorated edge value
- All Implemented Interfaces:
TraversalStrategy<Vertex<V,E>,Edge<V,E>>
public class DepthFirstSearchTraversalStrategy<V,E> extends Object implements TraversalStrategy<Vertex<V,E>,Edge<V,E>>
Depth-First Search traversal strategy for a given graph PseudoCode:
1 procedure DFS(G, v): 2 label v as explored 3 for all edges e in G.incidentEdges(v) do 4 if edge e is unexplored then 5 w ← G.adjacentVertex(v, e) 6 if vertex w is unexplored then 7 label e as a discovered edge 8 recursively call DFS(G, w) 9 else 10 label e as a back edge
- Since:
- 1.0
- Author:
- Andreas Schuler
-
-
Constructor Summary
Constructors Constructor Description DepthFirstSearchTraversalStrategy()
-
-
-
Method Detail
-
traverse
public void traverse(Visitor<Vertex<V,E>> visitor, Visitor<Edge<V,E>> edgeVisitor)
Description copied from interface:TraversalStrategy
Traverses through the graph- Specified by:
traverse
in interfaceTraversalStrategy<V,E>
- Parameters:
visitor
- visitor which is call when a vertex is visitededgeVisitor
- visitor which is call when an edge is visited
-
traverse
public void traverse(Visitor<Vertex<V,E>> visitor)
Description copied from interface:TraversalStrategy
Traverses through the graph- Specified by:
traverse
in interfaceTraversalStrategy<V,E>
- Parameters:
visitor
- visitor is call for every vertex which is visited
-
-