edu.upc.dama.dex.algorithms
Class WeakConnectivityDFS

java.lang.Object
  extended by edu.upc.dama.dex.tasks.Task
      extended by edu.upc.dama.dex.tasks.CompositeTask
          extended by edu.upc.dama.dex.algorithms.Connectivity
              extended by edu.upc.dama.dex.algorithms.WeakConnectivity
                  extended by edu.upc.dama.dex.algorithms.WeakConnectivityDFS
All Implemented Interfaces:
Algorithm

public class WeakConnectivityDFS
extends WeakConnectivity

This class can be used to solve the problem of finding weakly connected components in an undirected graph or in a directed graph which will be considered as an undirected one.

Concretely, it consists in finding components where every pair (u,v) of nodes contained in it has a path from u to v and from v to u. This implementation is based on the Depth-First Search (DFS) algorithm.

It is possible to set some restrictions after constructing a new instance of this class and before running it in order to limit the results. Those restrictions are:

For each instance of this class, it is only allowed to run the algorithm once.

After the execution, we can retrieve the results stored in an instance of the class ConnectedComponents using the Connectivity.getConnectedComponents() method.

Please, see edu.upc.dama.dex.algorithms for further information related to how to use this class.

NOTE: It is required to indicate the set of edge types and node types before running this algorithm.

Author:
Sparsity Technologies

Field Summary
 
Fields inherited from interface edu.upc.dama.dex.algorithms.Algorithm
NAVIGATION_BACKWARD, NAVIGATION_FORWARD, NAVIGATION_UNDIRECTED
 
Constructor Summary
WeakConnectivityDFS(Graph graph)
          Creates a new instance of WeakConnectivityDFS.
 
Method Summary
 void close()
          Closes the instance.
 void run()
          Runs the algorithm in order to find the connected components.
 
Methods inherited from class edu.upc.dama.dex.algorithms.Connectivity
addAllEdges, addAllNodes, addEdge, addNode, getConnectedComponents, setMaterializedAttribute
 
Methods inherited from class edu.upc.dama.dex.tasks.CompositeTask
cancel, execute, init
 
Methods inherited from class edu.upc.dama.dex.tasks.Task
main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakConnectivityDFS

public WeakConnectivityDFS(Graph graph)
Creates a new instance of WeakConnectivityDFS. After creating this instance is required to indicate the set of edge types and the set of node types which will be navigated through while traversing the graph in order to find the weak connected components.

Parameters:
graph - Graph on which the algorithm will be run.
Method Detail

close

public void close()
Description copied from class: Connectivity
Closes the instance.

Once executed, the instance becomes invalid.

Specified by:
close in class Connectivity

run

public void run()
Description copied from class: Connectivity
Runs the algorithm in order to find the connected components.

This method can be called only once.

Specified by:
run in class Connectivity