deltakit.core.decoding_graphs.DecodingHyperGraph#

class deltakit.core.decoding_graphs.DecodingHyperGraph(edge_data: Iterable[DecodingHyperEdge | tuple[int, ...] | tuple[DecodingHyperEdge, EdgeRecord]], detector_records: dict[int, DetectorRecord] | None = None)#

Bases: HyperMultiGraph[DecodingHyperEdge]

Representation of a decoding hypergraph, built to handle Stim-based noise sources. Each hyperedge in the graph has a weight between 0 and 1 (inclusive).

Parameters:
  • hyper_edges (Iterable[DecodingHyperEdge]) – Edges that form this graph.

  • detector_records (Optional[Dict[int, DetectorRecord]], optional) – Optional mapping of detector indices to detector records, by default None.

  • edge_records (Optional[Dict[DecodingHyperEdge, EdgeRecord]], optional) – Optional mapping of edges to edge records, by default None.

Methods#

DecodingHyperGraph.detector_is_boundary

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

DecodingHyperGraph.error_to_syndrome

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

DecodingHyperGraph.get_edge

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

DecodingHyperGraph.get_edge_record

Fetch the edge record for a sequence of detectors.

DecodingHyperGraph.get_edges

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

DecodingHyperGraph.get_relevant_nodes

Return nodes that have a hyperedge with a path to logical.

DecodingHyperGraph.incident_edges

Iterator for the incident edges connected to a given detector.

DecodingHyperGraph.neighbors

Iterator for the neighbours of a given detector.

DecodingHyperGraph.to_nx_decoding_graph

Lower hypergraph to NXDecodingGraph, on the condition that the hypergraph does not contain any hyperedges.

DecodingHyperGraph.to_parity_check_matrix

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