replace_edges_with_one_edge

samplomatic.graph_utils.replace_edges_with_one_edge(graph: PyDiGraph[T, S], parent_idx: int, child_idx: int, new_edge: S) int[source]

Replace all the parallel edges between two nodes with a single edge.

Parameters:
  • graph – The graph to mutate.

  • parent_idx – The index of the parent node.

  • child_idx – The index of the child node.

  • new_edge – The new edge.

Returns:

The indices of the new edges.