clustersim package¶
- class clustersim.ClusterState(num_nodes=0)¶
Bases:
objectAdapter class containing a GraphRegister object.
- Parameters:
num_nodes (
int)
- add_edge(qubit1, qubit2)¶
- add_node(vop='IA')¶
Add a node.
By default, the vertex operator corresponds to the |+> state. To add |0>, set vop to “YC”.
- property adjacency_list¶
- property adjacency_matrix¶
- apply_VOP(qubit, vop)¶
Apply vertex operators.
- duplicate(targets=None)¶
Generate a copy of the selection and return a larger object.
- edge_local_complementation(edge)¶
Apply an edge local complementation.
- classmethod from_cytoscape(data)¶
Load a simulator from cytoscape.
- Return type:
- classmethod from_json(json_data)¶
Create a ClusterState from JSON data in various formats.
- classmethod from_networkx(graph)¶
- Parameters:
graph (
Graph)- Return type:
- classmethod from_rustworkx(graph)¶
Create a graph state from rustworkx.
- Parameters:
graph (
PyGraph|PyDiGraph) – rustworkx graph.- Returns:
class object
- Return type:
- classmethod from_string(string, return_log=False)¶
Create a cluster state from a string representation of operations.
- Parameters:
- Return type:
- fusion_gate(qubit1, qubit2, fusion_type='XXZZ', mode='success', force=0)¶
Apply a fusion gate.
For more details, see https://arxiv.org/pdf/2312.02377.
- Parameters:
qubit1 (
int) – which qubit to applyqubit2 (
int) – which qubit to applyfusion_type (
str) – “XXZZ”, “XZZX”, “XYYZ”mode (str, optional) – Either “success”, “failure”, or “random”. Defaults to “success”.
force (int) – Force the measurements according to the following mapping: - 0 : Qubit 1 = 0, Qubit 2 = 0 - 1 : Qubit 1 = 0, Qubit 2 = 1 - 2 : Qubit 1 = 1, Qubit 2 = 0 - 3 : Qubit 1 = 1, Qubit 2 = 1 - -1 : Random measurement
- local_complementation(qubit)¶
Apply a local complementation.
- Parameters:
qubit (int) – which qubit to apply
- local_complementation_rewrite(qubit)¶
Apply a local complementation. This does not change the graph state.
This is because we apply local Cliffords to cancel out the state.
- Parameters:
qubit (int) – which qubit to apply
- measure(qubit, force=-1, basis='Z')¶
Measure a node in the graph state.
- property num_nodes¶
- classmethod random_graph(num_nodes, p=0.5, local_cliffords=False)¶
Generate a random graph.
- Parameters:
- Return type:
- remove_edge(qubit1, qubit2)¶
- property stabilizers¶
- subgraph(targets=None)¶
Generate a copy and return a larger object.
This does not copy any edges out of the selection.
- to_cytoscape(export_elements=False)¶
Export to cytoscape.
- to_json()¶
Convert the graph state to a JSON-serializable format.
- to_networkx(options={'neighbors': False, 'stabilizer': False, 'vop': True})¶
Export data from the underlying state.
Turning off vop = True may lead to unintended behaviour when recreating the state.
- Parameters:
options (dict, optional) – Default options. Defaults to {“stabilizer” : False, “vop”: True}.
- Returns:
networkx representation
- Return type:
nx.Graph
- to_rustworkx(options={'neighbors': False, 'stabilizer': False, 'vop': True})¶
Export data from the underlying state.
Turning off vop = True may lead to unintended behaviour when recreating the state.
- Parameters:
options (dict, optional) – Default options. Defaults to {“stabilizer” : False, “vop”: True}.
- Returns:
rustworkx representation
- Return type:
rx.PyGraph
- toggle_edge(qubit1, qubit2)¶
- property vertex_operators¶
Subpackages¶
- clustersim.app package
BrowserStateBrowserState.camera_stateBrowserState.from_json()BrowserState.layoutBrowserState.logBrowserState.offsetBrowserState.p_errBrowserState.path_clicksBrowserState.plot_optionsBrowserState.removed_nodesBrowserState.seedBrowserState.shapeBrowserState.to_json()BrowserState.xoffsetBrowserState.yoffsetBrowserState.zoffset
Grid3Dgrid_graph_3d()rx_graph_to_plot()update_plot_cytoscape()update_plot_plotly()- Submodules
- clustersim.app.layout module
- clustersim.app.state module
BrowserStateBrowserState.camera_stateBrowserState.from_json()BrowserState.layoutBrowserState.logBrowserState.offsetBrowserState.p_errBrowserState.path_clicksBrowserState.plot_optionsBrowserState.removed_nodesBrowserState.seedBrowserState.shapeBrowserState.to_json()BrowserState.xoffsetBrowserState.yoffsetBrowserState.zoffset
- clustersim.app.utils module
- clustersim.simulator package
ClusterStateClusterState.CX()ClusterState.CZ()ClusterState.H()ClusterState.I()ClusterState.M()ClusterState.MX()ClusterState.MY()ClusterState.MZ()ClusterState.S()ClusterState.SH()ClusterState.S_DAG()ClusterState.X()ClusterState.Y()ClusterState.Z()ClusterState.add_edge()ClusterState.add_node()ClusterState.adjacency_listClusterState.adjacency_matrixClusterState.apply_VOP()ClusterState.draw()ClusterState.duplicate()ClusterState.edge_local_complementation()ClusterState.from_cytoscape()ClusterState.from_json()ClusterState.from_networkx()ClusterState.from_rustworkx()ClusterState.from_string()ClusterState.fusion_gate()ClusterState.local_complementation()ClusterState.local_complementation_rewrite()ClusterState.measure()ClusterState.num_nodesClusterState.random_graph()ClusterState.remove_edge()ClusterState.remove_node()ClusterState.stabilizersClusterState.subgraph()ClusterState.to_cytoscape()ClusterState.to_json()ClusterState.to_networkx()ClusterState.to_rustworkx()ClusterState.toggle_edge()ClusterState.vertex_operators
FrontendClusterStateFrontendClusterState.CX()FrontendClusterState.CZ()FrontendClusterState.H()FrontendClusterState.I()FrontendClusterState.M()FrontendClusterState.MX()FrontendClusterState.MY()FrontendClusterState.MZ()FrontendClusterState.S()FrontendClusterState.SH()FrontendClusterState.S_DAG()FrontendClusterState.X()FrontendClusterState.Y()FrontendClusterState.Z()FrontendClusterState.add_edge()FrontendClusterState.add_group()FrontendClusterState.add_node()FrontendClusterState.adjacency_listFrontendClusterState.apply_VOP()FrontendClusterState.expand_selection()FrontendClusterState.from_cytoscape_elements()FrontendClusterState.from_dict()FrontendClusterState.from_json()FrontendClusterState.fusion_gate()FrontendClusterState.get_group()FrontendClusterState.get_group_children()FrontendClusterState.get_position()FrontendClusterState.get_value()FrontendClusterState.local_complementation()FrontendClusterState.local_complementation_rewrite()FrontendClusterState.measure()FrontendClusterState.num_nodesFrontendClusterState.push_state()FrontendClusterState.redo()FrontendClusterState.remove_edge()FrontendClusterState.remove_group()FrontendClusterState.remove_node()FrontendClusterState.resolve_qubit()FrontendClusterState.set_group()FrontendClusterState.set_position()FrontendClusterState.set_value()FrontendClusterState.snapshot()FrontendClusterState.stabilizersFrontendClusterState.to_cytoscape_elements()FrontendClusterState.to_dict()FrontendClusterState.to_json()FrontendClusterState.toggle_edge()FrontendClusterState.undo()FrontendClusterState.vertex_operators
- Submodules
- clustersim.simulator.cluster_state module
ClusterStateClusterState.CX()ClusterState.CZ()ClusterState.H()ClusterState.I()ClusterState.M()ClusterState.MX()ClusterState.MY()ClusterState.MZ()ClusterState.S()ClusterState.SH()ClusterState.S_DAG()ClusterState.X()ClusterState.Y()ClusterState.Z()ClusterState.add_edge()ClusterState.add_node()ClusterState.adjacency_listClusterState.adjacency_matrixClusterState.apply_VOP()ClusterState.draw()ClusterState.duplicate()ClusterState.edge_local_complementation()ClusterState.from_cytoscape()ClusterState.from_json()ClusterState.from_networkx()ClusterState.from_rustworkx()ClusterState.from_string()ClusterState.fusion_gate()ClusterState.local_complementation()ClusterState.local_complementation_rewrite()ClusterState.measure()ClusterState.num_nodesClusterState.random_graph()ClusterState.remove_edge()ClusterState.remove_node()ClusterState.stabilizersClusterState.subgraph()ClusterState.to_cytoscape()ClusterState.to_json()ClusterState.to_networkx()ClusterState.to_rustworkx()ClusterState.toggle_edge()ClusterState.vertex_operators