- cupyx.scipy.sparse.csgraph.connected_components(csgraph, directed=True, connection='weak', return_labels=True)#
Analyzes the connected components of a sparse graph
csgraph (cupy.ndarray of cupyx.scipy.sparse.csr_matrix) – The adjacency matrix representing connectivity among nodes.
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
tuple of int and cupy.ndarray, or int