causaldag.classes.ancestral_graph.AncestralGraph.remove_bidirected

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

Remove the bidirected edge between i and j.

Parameters:
  • i – first endpoint of bidirected edge.
  • j – second endpoint of bidirected edge.
  • ignore_error – If False, raises an error when the bidirected edge does not belong to the graph.

Examples

>>> import causaldag as cd
>>> g = cd.AncestralGraph(bidirected={(1, 2), (1, 4)}, directed={(1, 3), (2, 3)})
>>> g.remove_bidirected(1, 2)
>>> g
Directed edges: {(2, 3), (1, 3)}, Bidirected edges: {frozenset({1, 4})}, Undirected edges: set()