public class ConnectedComponents extends Object
compute(ImmutableGraph, int, ProgressLogger) method of this class will return an
instance that contains the data computed by visiting the graph (using an instance of
ParallelBreadthFirstVisit). Note that it is your responsibility to pass a symmetric graph
compute(ImmutableGraph, int, ProgressLogger). Otherwise, results will be
After getting an instance, it is possible to run the
sortBySize(long) methods to obtain further information. This scheme has been devised to
exploit the available memory as much as possible—after the components have been computed,
the returned instance keeps no track of the graph, and the related memory can be freed by the
This class uses an instance of
ParallelBreadthFirstVisit to ensure a high degree of
parallelism (see its documentation for memory requirements).
Fields Modifier and Type Field Description
longThe component of each node.
longThe number of connected components.
Constructors Modifier Constructor Description
(long numberOfComponents, long component)
Modifier and Type Method Description
ImmutableGraph symGraph, int threads, ProgressLogger pl)(Computes the connected components of a symmetric graph.
()Returns the size big array for this set of strongly connected components.
(long size)Renumbers by decreasing size the components of this set.
numberOfComponentspublic final long numberOfComponentsThe number of connected components.
componentpublic final long componentThe component of each node.
ConnectedComponentsprotected ConnectedComponents(long numberOfComponents, long component)
computeComputes the connected components of a symmetric graph.
symGraph- a symmetric graph.
threads- the requested number of threads (0 for
pl- a progress logger, or
- an instance of this class containing the computed components.
computeSizespublic long computeSizes()Returns the size big array for this set of strongly connected components.
- the size big array for this set of strongly connected components.
sortBySizepublic void sortBySize(long size)Renumbers by decreasing size the components of this set.
After a call to this method, both the internal status of this class and the argument big array are permuted so that the sizes of strongly connected components are decreasing in the component index.
size- the components sizes, as returned by