deltakit.core.decoding_graphs.graph_to_json#

deltakit.core.decoding_graphs.graph_to_json(decoding_graph: HyperMultiGraph[AnyEdgeT], logicals: Iterable[set[AnyEdgeT]], full: bool = False) str#

Represent some graph as an edge list in JSON. Logicals are also included. Fields are:

  • edges: List of sorted tuples for all edges

  • edge_weights: list of floats for edge weights

  • logicals: List of sorted tuples for logical edges

  • boundary: Decoding graph boundary. None if it doesn’t exist.

If full flag is True, we additionally serialise:

  • detector_records: dict containing detector metadata

  • edge_record: dict containing edge metadata

Parameters:
  • decoding_graph (HyperMultiGraph[AnyEdgeT]) – Graph to represent in JSON. Should have no more than one boundary.

  • logicals (Iterable[Set[AnyEdgeT]]) – Logicals to represent in JSON.

  • full (bool) – Whether to save full graph information that includes detector and edge records.

Returns:

JSON formatted string representing the essential graph and logical info

Return type:

str