---
title: replace_edges_with_one_edge (latest version)
description: API reference for samplomatic.graph_utils.replace_edges_with_one_edge in the latest version of samplomatic
source: https://quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/graph-utils-replace-edges-with-one-edge
---

# 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`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/graph_utils/replace_edges_with_one_edge.py#L25-L45)

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.
