CredalNet.addArc
- CredalNet.addArc(tail, head)
Adds an arc between two nodes
- Parameters:
tail (
int) – the id of the tail nodehead (
int) – the id of the head node
- Raises:
pyagrum.InvalidDirectedCircle – If any (directed) cycle is created by this arc
pyagrum.InvalidNode – If head or tail does not belong to the graph nodes
pyagrum.DuplicateElement – If one of the arc already exists
- Return type:
None
Example
import pyagrum as gum
cn = gum.CredalNet()
a = cn.addVariable("A", 2)
b = cn.addVariable("B", 2)
cn.addArc(a, b)
cn.src_bn().arcs()
# {(0, 1)}
Class