graphical_models.classes.mags.ancestral_graph.AncestralGraph.remove_undirected

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

Remove the undirected edge between i and j.

Parameters
  • i – first endpoint of undirected edge.

  • j – second endpoint of undirected edge.

  • ignore_error – If False, raises an error when the undirected 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_undirected(1, 4)
>>> g
Directed edges: {(1, 2), (1, 3)}, Bidirected edges: set(), Undirected edges: set()