cugraph.dask.components.connectivity.weakly_connected_components#

cugraph.dask.components.connectivity.weakly_connected_components(input_graph)[source]#

Generate the Weakly Connected Components and attach a component label to each vertex.

Parameters:
input_graphcugraph.Graph

The graph descriptor should contain the connectivity information and weights. The adjacency list will be computed if not already present. The current implementation only supports undirected graphs.

Returns:
resultdask_cudf.DataFrame

GPU distributed data frame containing 2 dask_cudf.Series

ddf[‘vertex’]: dask_cudf.Series

Contains the vertex identifiers

ddf[‘labels’]: dask_cudf.Series

Contains the wcc labels

Examples

>>> import cugraph.dask as dcg
>>> import dask_cudf
>>> # ... Init a DASK Cluster
>>> #    see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
...                          blocksize=chunksize, delimiter=" ",
...                          names=["src", "dst", "value"],
...                          dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=False)
>>> dg.from_dask_cudf_edgelist(ddf, source='src', destination='dst',
...                            edge_attr='value')
>>> result = dcg.weakly_connected_components(dg)