---
title: graph_utils (latest version)
description: API reference for samplomatic.graph_utils in the latest version of samplomatic
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/samplomatic/graph-utils
---

# samplomatic.graph\_utils

Graph Utilities

## Functions

|                                                                                                                                                                       |                                                                               |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [`find_unreachable_nodes`](/docs/api/samplomatic/auto/graph-utils-find-unreachable-nodes "samplomatic.graph_utils.find_unreachable_nodes")(graph, start\_idxs)        | Find all nodes from the graph that are not reachable from the start nodes.    |
| [`get_clusters`](/docs/api/samplomatic/auto/graph-utils-get-clusters "samplomatic.graph_utils.get_clusters")(graph, filter\_fn)                                       | Yield lists of nodes that all pass the filter and are connected in the graph. |
| [`replace_edges_with_one_edge`](/docs/api/samplomatic/auto/graph-utils-replace-edges-with-one-edge "samplomatic.graph_utils.replace_edges_with_one_edge")(graph, ...) | Replace all the parallel edges between two nodes with a single edge.          |
| [`replace_nodes_with_one_node`](/docs/api/samplomatic/auto/graph-utils-replace-nodes-with-one-node "samplomatic.graph_utils.replace_nodes_with_one_node")(graph, ...) | Replace given nodes with a single node, preserving all outward/inward edges.  |

## Classes

|                                                                                                                               |                                                       |
| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| [`NodeCandidate`](/docs/api/samplomatic/auto/graph-utils-node-candidate "samplomatic.graph_utils.NodeCandidate")(graph, node) | A node that we want to add to the graph, but not yet. |
