GraphLab Project

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)
          Calling this will not reset the marks.
 boolean doSearch(VertexType vertex, PreWorkPostWorkHandler<VertexType> handler, boolean resetMarks)
          Runs Depth First Search (DFS) algorithm on the graph starting from vertex vertexId.
 
Methods inherited from class graphlab.library.algorithms.Algorithm
acceptEventDispatcher, dispatchEvent, getDispatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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)
Calling this will not reset the marks.

Parameters:
vertex - 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.

doSearch

public boolean doSearch(VertexType vertex,
                        PreWorkPostWorkHandler<VertexType> handler,
                        boolean resetMarks)
                 throws InvalidVertexException,
                        InvalidGraphException
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:
vertex - 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.
resetMarks - If the search should reset vertex visit marks.
Returns:
Whether the traversal has stopped at the middle by the handler.
Throws:
InvalidVertexException
InvalidGraphException

doAlgorithm

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

GraphLab Project