graphsim package

Pybind11 bindings for GraphSim

class graphsim.GraphRegister(self: graphsim._core.GraphRegister, num_qubits: SupportsInt | SupportsIndex, randomize: SupportsInt | SupportsIndex = -1)

Bases: pybind11_object

A quantum register representing a graph state and local Clifford operators.

Initialize a quantum register with ‘num_qubits’ qubits.

CX(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None

Apply Controlled-NOT (CX) gate between control and target vertices.

CZ(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None

Apply Controlled-Phase (CZ) gate between two vertices.

H(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex) None

Apply Hadamard gate to a vertex.

S(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex) None

Apply Phase rotation (S gate) to a vertex.

VOP(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex, arg1: graphsim._core.LocCliffOp) None

Apply a local Clifford operation to a vertex.

X(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex) None

Apply Bit flip (X gate) to a vertex.

Z(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex) None

Apply Phase flip (Z gate) to a vertex.

add_edge(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None

Add an edge between two vertices.

adjacency_list(self: graphsim._core.GraphRegister) list[set[int]]

Get the adjacency list of the graph.

adjacency_matrix(self: graphsim._core.GraphRegister) numpy.typing.NDArray[numpy.uint8]

Get the adjacency matrix of the graph as a NumPy array (entries are 0 or 1).

del_edge(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None

Delete an edge between two vertices.

invert_neighborhood(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex) None

Invert the neighborhood of a vertex (Local Complementation).

measure(self: graphsim._core.GraphRegister, vertex: SupportsInt | SupportsIndex, force: SupportsInt | SupportsIndex = -1, basis: str = 'Z') int

Measure a qubit in the specified basis (X, Y, or Z).

merge(self: graphsim._core.GraphRegister, other: graphsim._core.GraphRegister) graphsim._core.GraphRegister

Merge another GraphRegister with this one, returning a new combined register.

num_qubits(self: graphsim._core.GraphRegister) int

Get the number of qubits in the register.

print_adjacency_list(self: graphsim._core.GraphRegister) str

Return the adjacency list as a string.

stabilizer_list(self: graphsim._core.GraphRegister) list[str]

Get the list of stabilizer generators.

toggle_edge(self: graphsim._core.GraphRegister, arg0: SupportsInt | SupportsIndex, arg1: SupportsInt | SupportsIndex) None

Toggle an edge between two vertices.

vop_list(self: graphsim._core.GraphRegister) list[str]

Get the list of local Clifford operators.

class graphsim.LocCliffOp(*args, **kwargs)

Bases: pybind11_object

Class representing a Local Clifford Operator.

Overloaded function.

  1. __init__(self: graphsim._core.LocCliffOp, op: typing.SupportsInt | typing.SupportsIndex) -> None

Construct by its assigned integer.

  1. __init__(self: graphsim._core.LocCliffOp, signsymb: typing.SupportsInt | typing.SupportsIndex, permsymb: typing.SupportsInt | typing.SupportsIndex) -> None

    Construct from Pauli and permutation integers.

    Args:

    signsymb (int): A Pauli integer representing “I”, “X”, “Y” or “Z” in the range [0, 3]. permsymb (int): A permutation integer in the range [0, 5].

  2. __init__(self: graphsim._core.LocCliffOp, s: str) -> None

Construct from string representation (e.g. ‘IA’).

conjugate(self: graphsim._core.LocCliffOp, other: graphsim._core.LocCliffOp) str

Conjugate the operator by another Local Clifford Operator.

get_matrix(self: graphsim._core.LocCliffOp) numpy.typing.NDArray[numpy.complex64]

Get the matrix representation of the operator.

get_name(self: graphsim._core.LocCliffOp) str

Get the string representation of the operator.

herm_adjoint(self: graphsim._core.LocCliffOp) graphsim._core.LocCliffOp

Get the Hermitian adjoint of the operator.

isXY(self: graphsim._core.LocCliffOp) bool

Check if the operator is X or Y type.

is_diagonal(self: graphsim._core.LocCliffOp) bool

Check if the operator is diagonal.

static mult_phase(op1: graphsim._core.LocCliffOp, op2: graphsim._core.LocCliffOp) str

Static method to multiply/conjugate two operators and return the phase name.

property op