tn_noise_learning.topology#
Qubit connectivity on which an LPDO places its virtual bonds.
Topology
dataclass
#
Topology(
num_sites: int, edges: tuple[tuple[int, int], ...]
)
Graph of qubit sites 0..num_sites-1 and the edges that carry virtual bonds.
Site integers are the qubit order of the dataset and of the Qiskit circuit. Edges are
stored normalised as sorted (i, j) pairs with i < j, without duplicates.
| PARAMETER | DESCRIPTION |
|---|---|
num_sites
|
number of qubits.
TYPE:
|
edges
|
pairs of sites connected by a bond. |
__post_init__ #
__post_init__() -> None
Validate sites and normalise the edge list.
Source code in src/tn_noise_learning/topology.py
43 44 45 46 47 48 49 50 51 52 53 54 | |
chain
classmethod
#
chain(num_sites: int) -> Topology
Open 1D chain 0 - 1 - ... - (num_sites - 1).
Source code in src/tn_noise_learning/topology.py
56 57 58 59 | |
degree #
degree(site: int) -> int
Number of bonds attached to site.
Source code in src/tn_noise_learning/topology.py
79 80 81 | |
from_edges
classmethod
#
from_edges(
edges: Iterable[tuple[int, int]],
num_sites: int | None = None,
) -> Topology
Custom topology from an edge list; num_sites defaults to the largest site index plus one.
Source code in src/tn_noise_learning/topology.py
67 68 69 70 71 72 73 | |
neighbors #
neighbors(site: int) -> tuple[int, ...]
Sites bonded to site, in ascending order.
Source code in src/tn_noise_learning/topology.py
75 76 77 | |
square
classmethod
#
square(rows: int, cols: int) -> Topology
Open 2D square lattice, with site (r, c) mapped row-major to r * cols + c.
Source code in src/tn_noise_learning/topology.py
61 62 63 64 65 | |