Open Graph

graphix.opengraph module

This module defines classes for defining MBQC patterns as Open Graphs.

class graphix.opengraph.OpenGraph(inside: nx.Graph[int], measurements: dict[int, Measurement], inputs: list[int], outputs: list[int])[source]

Open graph contains the graph, measurement, and input and output nodes.

This is the graph we wish to implement deterministically.

Parameters:
  • inside – the underlying networkx.Graph state

  • measurements – a dictionary whose key is the ID of a node and the value is the measurement at that node

  • inputs – an ordered list of node IDs that are inputs to the graph

  • outputs – an ordered list of node IDs that are outputs of the graph

Example

>>> import networkx as nx
>>> from graphix.fundamentals import Plane
>>> from graphix.opengraph import OpenGraph, Measurement
>>>
>>> inside_graph = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>>
>>> measurements = {i: Measurement(0.5 * i, Plane.XY) for i in range(2)}
>>> inputs = [0]
>>> outputs = [2]
>>> og = OpenGraph(inside_graph, measurements, inputs, outputs)
class graphix.opengraph.Measurement(angle: ExpressionOrFloat, plane: Plane)[source]

An MBQC measurement.

Parameters:
  • angle – the angle of the measurement. Should be between [0, 2)

  • plane – the measurement plane