graphical_models.classes.dags.dag.DAG.remove_node

DAG.remove_node(node: Hashable, ignore_error=False)[source]

Remove the node node from the graph.

Parameters
  • node – node to be removed.

  • ignore_error – if True, ignore the KeyError raised when node is not in the DAG.

Examples

>>> from graphical_models import DAG
>>> g = DAG(arcs={(1, 2)})
>>> g.remove_node(2)
>>> g.nodes
{1}