deltakit.core.decoding_graphs.compute_graph_distance#

deltakit.core.decoding_graphs.compute_graph_distance(decoding_graph: NXDecodingGraph, logicals: Sequence[Set[DecodingEdge]], weighted: bool = False) int | float#

Calculates the minimum distance for all logicals. See compute_graph_distance_for_logical. Decoding graph to calculate the distance on.

logicalsNXLogicals

Reference logicals.

weightedbool

Whether to calculate the distance in terms of number of edges or the weight.

Note: this method is not fully general and will not work well for all definitions of the logical! In particular, it fails if the smallest weight logical operator has a support on the logical greater than 1. I.e. if non-trivial logical loop of edges crosses the logical more than once. However, this should be satisfied for most surface codes with usual definition of logicals. It is likely possible to do this more generally on a matching graph by trying to find a shortest path from every point to itself (using a modified Dijkstra) that contains the odd number of logical crossings.

Returns:

Decoding graph distance. Returns float if weighted is True.

Return type:

Union[int, float]