DiGraph.connectedComponentsList

DiGraph.connectedComponentsList()

connected components as a dict of sets

Returns:

dict of connected components (as sets of nodeIds) keyed by the index of the component.

Return type:

dict(int, set[int])

Example

import pyagrum as gum

g = gum.fastDiGraph("A->B<-C;D->E")
sorted(g.connectedComponentsList().values(), key=min)
# [{0, 1, 2}, {3, 4}]

Used by

DiGraph, DAG

Inheritance diagram of pyagrum.DiGraph, pyagrum.DAG

Overridden in

UndiGraph.connectedComponentsList