UndiGraph.addEdge

UndiGraph.addEdge(*args)

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

Class

UndiGraph

Overridden in

ChainGraph.addEdge, CliqueGraph.addEdge, MixedGraph.addEdge, PDAG.addEdge