graphlab.library.algorithms.traversal
Class DepthFirstSearch<VertexType extends BaseVertex,EdgeType extends BaseEdge<VertexType>>

java.lang.Object
  extended by graphlab.library.algorithms.Algorithm
      extended by graphlab.library.algorithms.traversal.DepthFirstSearch<VertexType,EdgeType>
All Implemented Interfaces:
AlgorithmInterface, AutomatedAlgorithm
Direct Known Subclasses:
DFSAnim

public class DepthFirstSearch<VertexType extends BaseVertex,EdgeType extends BaseEdge<VertexType>>
extends Algorithm
implements AutomatedAlgorithm

Author:
Omid Aladini

Constructor Summary
DepthFirstSearch()
           
DepthFirstSearch(BaseGraph<VertexType,EdgeType> graph)
           
 
Method Summary
 void doAlgorithm()
           
 boolean doSearch(VertexType vertex, PreWorkPostWorkHandler<VertexType> handler)
          Runs Depth First Search (DFS) algorithm on the graph starting from vertex vertexId.
 
Methods inherited from class graphlab.library.algorithms.Algorithm
acceptEventDispatcher, dispatchEvent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface graphlab.library.algorithms.AlgorithmInterface
acceptEventDispatcher
 

Constructor Detail

DepthFirstSearch

public DepthFirstSearch(BaseGraph<VertexType,EdgeType> graph)

DepthFirstSearch

public DepthFirstSearch()
Method Detail

doSearch

public boolean doSearch(VertexType vertex,
                        PreWorkPostWorkHandler<VertexType> handler)
                 throws InvalidVertexException
Runs Depth First Search (DFS) algorithm on the graph starting from vertex vertexId. A reference to a PreWorkPostWorkHandler is supplied that contains implementation of pre-work and post-work operations that depends on the application of DFS.

Parameters:
vertexId - Index of the starting vertex of the traversal.
handler - A reference to a PreWorkPostWorkHandler that contains implementation of pre-work and post-work operations that depends on the application of DFS.
Returns:
Whether the traversal has stopped at the middle by the handler.
Throws:
InvalidVertexException

doAlgorithm

public void doAlgorithm()
Specified by:
doAlgorithm in interface AutomatedAlgorithm