Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
build_distance_graph¶
- build_distance_graph(graph, distance, node_subset=None)[source]¶
Build a graph where nodes are connected if their distance is less than a threshold.
The nodes of the distance graph are the same as in the original graph. Two nodes are connected by an edge if the distance between them in the original graph is smaller than distance. The nodes of the distance graph are labeled as in the original graphs. The edges are not labeled.
If node_subset is not None then only the nodes specified in node_subset will also become nodes of the distance graph.
- Parameters:
graph (PyGraph) – A rustworkx.PyGraph instance
distance (int) – Minimum distance threshold
node_subset (list | None) – Optional subset of nodes to include
- Returns:
The distance graph
- Return type:
PyGraph