PyZX Utilities¶
graphqomb.zx_util module¶
PyZX integration utilities.
This module provides:
PyZXDiagram: Protocol describing the PyZX graph interface used for import.VertexData: Collected PyZX vertex metadata used during import.EdgeData: Collected PyZX edge metadata used during import.from_pyzx: Convert a graph-like PyZX diagram into aGraphState.
Protocols¶
Data Classes¶
- class graphqomb.zx_util.VertexData[source]¶
Collected PyZX vertex metadata used during import.
- vertex_type¶
PyZX vertex type.
- Type:
VertexType
- phase¶
PyZX vertex phase in multiples of pi.
- Type:
FractionLike
- qubit¶
PyZX qubit coordinate.
- Type:
FloatInt
- row¶
PyZX row coordinate.
- Type:
FloatInt
- __init__(vertex_id, vertex_type, phase, qubit, row, is_ground)¶
Functions¶
- graphqomb.zx_util.from_pyzx(diagram, *, recognize_pg=False)[source]¶
Convert a graph-like PyZX diagram into a graph state.
- Parameters:
diagram (
PyZXDiagram) – Input PyZX diagram in graph-like form.recognize_pg (
bool, optional) – Whether to recognize supported lone-Z phase gadgets and import their neighbors as YZ-plane measurements.
- Returns:
Imported graph state.
- Return type:
- Raises:
ValueError – If the input diagram is not in strict graph-like form or contains ground vertices.