Graph state generation

graphix.extraction module

This provides functions to extract clusters from a given the graph state.

class graphix.extraction.ResourceGraph(type: ResourceType, graph: Optional[GraphState] = None)[source]

resource graph state object.

Parameters
  • type (ResourceType object) – Type of the cluster.

  • graph (GraphState object) – Graph state of the cluster.

__init__(type: ResourceType, graph: Optional[GraphState] = None)[source]
graphix.extraction.get_fusion_network_from_graph(graph: BaseGraphState, max_ghz: int | float = inf, max_lin: int | float = inf) list[graphix.extraction.ResourceGraph][source]

Extract GHZ and linear cluster graph state decomposition of desired resource state GraphState. Extraction algorithm is based on [1].

[1] Zilk et al., A compiler for universal photonic quantum computers, 2022 arXiv:2210.09251

Parameters
  • graph (GraphState object) – Graph state.

  • phasedict (dict) – Dictionary of phases for each node.

  • max_ghz – Maximum size of ghz clusters

  • max_lin – Maximum size of linear clusters

Returns

List of ResourceGraph objects.

Return type

list

graphix.extraction.create_resource_graph(node_ids: list[int], root: Optional[int] = None, use_rustworkx=False) ResourceGraph[source]

Create a resource graph state (GHZ or linear) from node ids.

Parameters
  • node_ids (list) – List of node ids.

  • root (int) – Root of the ghz cluster. If None, it’s a linear cluster.

Returns

Cluster object.

Return type

Cluster object

graphix.extraction.get_fusion_nodes(c1: ResourceGraph, c2: ResourceGraph) list[int][source]

Get the nodes that are fused between two resource states. Currently, we consider only type-I fusion. See [2] for the definition of fusion operation.

[2] Daniel E. Browne and Terry Rudolph. Resource-efficient linear optical quantum computation. Physical Review Letters, 95(1):010501, 2005.

Parameters
  • c1 (ResourceGraph object) – First resource state to be fused.

  • c2 (ResourceGraph object) – Second resource state to be fused.

Returns

List of nodes that are fused between the two clusters.

Return type

list