nocad.components.strongly_connected_components#
- nocad.components.strongly_connected_components(adj)[source]#
Label of the strongly connected component of every node.
Labels are
0..p-1in a topological order of the condensation: every edge between two components goes from a smaller to a larger label.- Parameters:
- adjarray_like or
sparse,shape(N,N)
- adjarray_like or
- Returns:
- labels
ndarrayofshape(N,)
- labels
Examples
>>> strongly_connected_components([[0, 1, 0], [1, 0, 1], [0, 0, 0]]) array([0, 0, 1])