BayesNet.parents

BayesNet.parents(*args)

give the set of nodeid of the parents of a node (or of a set of nodes)

Parameters:

norid (int | str | set[int] | list[str]) – the name or the id of the node, or a set of ids or a list of names

Returns:

the set of ids of the parents.

Return type:

set

Example

import pyagrum as gum

bn = gum.fastBN("A->C<-B;C->D")
bn.parents("C")
# {0, 2}
bn.parents(["C", "D"])
# {0, 1, 2}

Class

BayesNet