MixedGraph.addArc

MixedGraph.addArc(n1, n2)

Add an arc from n1 to n2.

Parameters:
  • n1 (int) – the id of the tail node

  • n2 (int) – the id of the head node

Raises:

pyagrum.InvalidNode – If n1 or n2 does not belong to the graph nodes.

Return type:

None

Example

import pyagrum as gum

g = gum.MixedGraph()
g.addNodes(3)
# {0, 1, 2}
g.addArc(0, 1)
g.addEdge(1, 2)
g.arcs(), g.edges()
# ({(0, 1)}, {(1, 2)})

Class

MixedGraph

Overridden in

ChainGraph.addArc, PDAG.addArc