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.

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.

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.

get_neighbors(node)

Returns the neighbors of a given node in the lattice.

get_neighbors(node)[source]

Returns the neighbors of a given node in the lattice.

Parameters

node – a target node label.