- cupyx.scipy.sparse.csgraph.connected_components(csgraph, directed=True, connection='weak', return_labels=True)#
Analyzes the connected components of a sparse graph
directed (bool) – If
True, it operates on a directed graph. If
False, it operates on an undirected graph.
connection (str) –
'strong'. For directed graphs, the type of connection to use. Nodes i and j are “strongly” connected only when a path exists both from i to j and from j to i. If
False, this argument is ignored.
return_labels (bool) – If
True, it returns the labels for each of the connected components.
True, returns a tuple
(n, labels), where
nis the number of connected components and
labelsis labels of each connected components. Otherwise, returns
- Return type