InfluenceDiagram.variables

InfluenceDiagram.variables(*args)

Return the variables of the model: all of them, or those corresponding to a list of names or to a set of node ids.

Parameters:

args (list[str] or set[int], optional) – variable names or node ids (all the variables of the model if absent)

Returns:

the corresponding variables

Return type:

set[pyagrum.DiscreteVariable]

Raises:

pyagrum.NotFound – If a name or an id is not the one of a variable of the model.

Example

import pyagrum as gum

diag = gum.fastID("C->*D->$U<-C")
sorted(v.name() for v in diag.variables())
# ['C', 'D', 'U']
sorted(v.name() for v in diag.variables(["D", "U"]))
# ['D', 'U']

Class

InfluenceDiagram