causaldag.classes.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

>>> import causaldag as cd
>>> g = cd.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()