DAG.minimalCondSet

DAG.minimalCondSet(target, soids)

Return a minimal conditioning set of a target given source nodes in the DAG.

Parameters:
  • target (int | str | list[int | str]) – the target node id(s) or name(s)

  • soids (list[int | str]) – the list of source node ids or names

Returns:

the minimal conditioning set (as node ids)

Return type:

set[int]

Example

import pyagrum as gum

dag = gum.fastDAG("A->B->C;D->B;C->E")
# the sources needed to make C independent of the other sources
dag.minimalCondSet(2, (0, 1, 3, 4))
# {1, 4}
dag.minimalCondSet("C", ["A", "D"])  # ids, names or both
# {0, 3}

Class

DAG