deltakit.core.decoding_graphs.NXDecodingGraph#

class deltakit.core.decoding_graphs.NXDecodingGraph(graph: _QECNX, boundaries: Iterable[int] = frozenset({}))#

Bases: NXGraph[_QECNX, DecodingEdge]

Implementation of a decoding graph using NetworkX and the QEC syndrome and edge objects. This works much like the hypergraph, but all edges are size 2. To account for boundaries, which in a hypergraph exist as size 1 edges, extra nodes may be added. These are virtual detectors that do not physically exist when running the syndrome extraction circuit.

Parameters:
  • graph (_QECNX) – NetworkX graph to wrap.

  • boundaries (Optional[Iterable[int]], optional) – Optional indices of detectors that should be treated as a boundary, by default None.

Methods#

NXDecodingGraph.detector_is_boundary

Return True if given detector is a boundary, False otherwise.

NXDecodingGraph.error_to_syndrome

Assume an error has happened on the given edges and return the corresponding syndrome.

NXDecodingGraph.from_edge_list

Create a graph, where connectivity is defined by an edge list.

NXDecodingGraph.get_edge

Returns the unique edge in the graph corresponding to the given set of detector indices.

NXDecodingGraph.get_edge_record

Given a set of detectors that define an edge in the graph, return its correspoiding EdgeRecord.

NXDecodingGraph.get_edges

Generator for the edges defined by the given set of detectors.

NXDecodingGraph.get_relevant_nodes

Return the nodes that have an edge with a path to logical that is not via the boundary

NXDecodingGraph.incident_edges

Iterator for the incident edges connected to a given detector.

NXDecodingGraph.neighbors

Iterator for the neighbours of a given detector.

NXDecodingGraph.shortest_path

Find the shortest path between two syndrome bits, as a sequence of decoding edges.

NXDecodingGraph.shortest_path_length

Find the length of the shortest path between two syndrome bits.

NXDecodingGraph.shortest_path_length_no_boundaries

Find the length of the shortest path between two syndrome bits without going via any boundaries.

NXDecodingGraph.shortest_path_no_boundaries

Find the shortest path between two syndrome bits without going via any boundaries, as a sequence of decoding edges.

NXDecodingGraph.to_decoding_hypergraph

Elevate decoding graph to hypergraph.

NXDecodingGraph.to_parity_check_matrix

Convert the hypergraph to a parity check matrix of size (len(nodes), len(edges)).