CPDAG.connectedComponents

CPDAG.connectedComponents()

The connected components of the graph (of its skeleton).

Returns:

each node id mapped to the id of the root of its component

Return type:

dict[int, int]

Example

import pyagrum as gum

cpdag = gum.CPDAG.fromDAG(gum.fastDAG("A->B;C->D"))
cc = cpdag.connectedComponents()
cc[0] == cc[1], cc[0] == cc[2]
# (True, False)

Used by

CPDAG, EssentialGraph

Inheritance diagram of pyagrum.CPDAG, pyagrum.EssentialGraph