Pattern converter

graphix_perceval.converter module

graphix_perceval.converter.fusion_circuit(ph1: Photon, ph2: Photon) Circuit[source]

Create a Perceval Circuit for fusing two photons.

Parameters
  • ph1 (Photon) – First photon.

  • ph2 (Photon) – Second photon.

Returns

Perceval Circuit for fusing two photons.

Return type

perceval.Circuit

graphix_perceval.converter.ghz_circuit(num_photons: int, name: str = '') Circuit[source]

Create a Perceval Circuit for a GHZ ResourceGraph.

Parameters

num_photons (int) – Number of photons.

Returns

Perceval Circuit for a GHZ ResourceGraph.

Return type

perceval.Circuit

graphix_perceval.converter.linear_circuit(num_photons: int, name: str = '') Circuit[source]

Create a Perceval Circuit for a linear ResourceGraph.

Parameters

num_photons (int) – Number of photons.

Returns

Perceval Circuit for a linear ResourceGraph.

Return type

perceval.Circuit

graphix_perceval.converter.local_clifford_circuit(clifford_id: int) Circuit[source]

Create a Perceval Circuit for a local clifford.

Parameters
  • mode_id (int) – Mode id.

  • clifford_id (int) – Clifford id.

Returns

Perceval Circuit for a local clifford.

Return type

perceval.Circuit

graphix_perceval.converter.pattern2graphstate(pattern: Pattern) tuple[graphix.graphsim.GraphState, dict[int, float], list[int]][source]

Create a graph state from a MBQC pattern.

Parameters

pattern (graphix.Pattern object) – MBQC pattern to be run on the device

Returns

  • graph_state (graphix.GraphState object) – Graph state corresponding to the pattern.

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

  • output_nodes (list) – List of output nodes.

graphix_perceval.converter.to_perceval(pattern: Pattern) PercevalExperiment[source]

Convert a graphix.Pattern to a perceval.Circuit.

Parameters

pattern (graphix.Pattern) – GraphState to be converted to a perceval.Circuit

Returns

experimentgraphix_perceval.experiment.PercevalExperiment object

Return type

PercevalExperiment

class graphix_perceval.converter.PercevalCircuitConstructor[source]
__init__()[source]
add_fusions() None[source]

Find edges that connects two ResourceGraphs. If the two ResourceGraphs share a same node id, then they are fused. Type-1 fusion.