jdsl.core.algo.graphtraversals
Class NumConnectedComponents

java.lang.Object
  |
  +--jdsl.core.algo.graphtraversals.NumConnectedComponents

public class NumConnectedComponents
extends java.lang.Object

This algorithm computes the number of connected components of a graph using depth-first search. The algorithm examins all vertices in the graph, and uses each unmarked vertex as a start vertex as start vertex for DFS. After each DFS is performed, the vertices in the connected component of the start vertex are marked so that they are not examined again.

Author:
Natasha Gelfand

Constructor Summary
NumConnectedComponents()
           
 
Method Summary
 int numComponents(InspectableGraph g)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumConnectedComponents

public NumConnectedComponents()
Method Detail

numComponents

public int numComponents(InspectableGraph g)