Class ConnectivityInspector<V,E>

java.lang.Object
org.jgrapht.alg.ConnectivityInspector<V,E>
All Implemented Interfaces:
EventListener, GraphListener<V,E>, VertexSetListener<V>

public class ConnectivityInspector<V,E> extends Object implements GraphListener<V,E>
Allows obtaining various connectivity aspects of a graph. The inspected graph is specified at construction time and cannot be modified. Currently, the inspector supports connected components for an undirected graph and weakly connected components for a directed graph. To find strongly connected components, use StrongConnectivityInspector instead.

The inspector methods work in a lazy fashion: no computation is performed unless immediately necessary. Computation are done once and results and cached within this class for future need.

The inspector is also a GraphListener. If added as a listener to the inspected graph, the inspector will amend internal cached results instead of recomputing them. It is efficient when a few modifications are applied to a large graph. If many modifications are expected it will not be efficient due to added overhead on graph update operations. If inspector is added as listener to a graph other than the one it inspects, results are undefined.

Since:
Aug 6, 2003
Author:
Barak Naveh, John V. Sichi
  • Constructor Details

    • ConnectivityInspector

      public ConnectivityInspector(UndirectedGraph<V,E> g)
      Creates a connectivity inspector for the specified undirected graph.
      Parameters:
      g - the graph for which a connectivity inspector to be created.
    • ConnectivityInspector

      public ConnectivityInspector(DirectedGraph<V,E> g)
      Creates a connectivity inspector for the specified directed graph.
      Parameters:
      g - the graph for which a connectivity inspector to be created.
  • Method Details