qml.ftqc.Lattice¶
- class Lattice(lattice_shape, graph=None, nodes=None, edges=None)[source]¶
Bases:
object
Represents a qubit lattice structure.
This Lattice class, inspired by the design of
Lattice
, leverages NetworkX to represent the relationships within the lattice structure.- Args:
lattice_shape: Name of the lattice shape. graph (nx.Graph): A NetworkX undirected graph object. If provided, nodes and edges are ignored. nodes (List): Nodes to construct a graph object. Ignored if graph is provided. edges (List): Edges to construct the graph. Ignored if graph is provided.
- Raises:
ValueError: If neither graph nor both nodes and edges are provided.
Attributes
Returns all edges in the lattice.
Returns the underlying NetworkX graph object representing the lattice.
Returns all nodes in the lattice.
Returns the lattice shape name.
- edges¶
Returns all edges in the lattice.
- graph¶
Returns the underlying NetworkX graph object representing the lattice.
- nodes¶
Returns all nodes in the lattice.
- shape¶
Returns the lattice shape name.
Methods
get_neighbors
(node)Returns the neighbors of a given node in the lattice.