graphical_models.classes.mags.ancestral_graph.AncestralGraph.remove_edge

AncestralGraph.remove_edge(i: Hashable, j: Hashable, ignore_error=False)[source]

Remove the edge between i and j, regardless of edge type.

Parameters
  • i – first endpoint of edge.

  • j – second endpoint of edge.

  • ignore_error – If False, raises an error when the edge does not belong to the graph.

Examples

>>> from graphical_models import AncestralGraph
>>> g = AncestralGraph(directed={(1, 2), (1, 3)}, undirected={(1, 4)})
>>> g.remove_edge(1, 4)
>>> g
Directed edges: {(1, 2), (1, 3)}, Bidirected edges: set(), Undirected edges: set()