MixedGraph.addEdge

MixedGraph.addEdge(n1, n2)

Insert a new edge into the graph.

Parameters:
  • n1 (int) – the id of one node of the new inserted edge

  • n2 (int) – the id of the other node of the new inserted edge

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.addEdge(1, 2)
g.addArc(0, 1)
g.edges(), g.arcs()
# ({(1, 2)}, {(0, 1)})

Class

MixedGraph

Overridden in

ChainGraph.addEdge, PDAG.addEdge