Code graph functions

Functions to access and manipulate the CodeGraph associated with a TensorNetworkCode.

Introductory notes

  • Node labels are of type Int with negative and positive integers representing virtual nodes and physical qubits, respectively.
  • Edge labels are of type Set{Int} and contain two elements corresponding to the labels of the nodes that the edge links.
  • Node coordinates are of type Vector{<:Real} and contain two elements corresponding to 2-dimensional Cartesian coordinates.
  • Node types are of type String and can take the values: "physical" for physical qubits or else they take the name of a seed code for virtual nodes, e.g., "Five qubit code".
  • Edge types are of type String and can take the values: "physical" for an edge between a virtual node and physical (i.e., qubit) node or "bond" for an edge between two virtual nodes, e.g., as occurs after contracting a "Five qubit code" and a "Steane code".
  • Edge indices are of type Vector{ITensors.Index{Int64}}}. These are lists of the indices necessary for tensor-network contraction (e.g., for decoding).
  • Node indices are also of type Vector{ITensors.Index{Int64}}}. These indices match the indices on the incident edges to that node. This is necessary for, e.g., tensor-network decoding: when a tensor is created at a node, the first index in the list of node indices corresponds to the first qubit of the seed code, and so on.

Specialized functions

TensorNetworkCodes.edgesFunction
edges(code) -> Vector{Set{Int}}

Returns a list of edge labels for the code, corresponding to edges between nodes.

source
TensorNetworkCodes.nodesFunction
nodes(code::TensorNetworkCode) -> Vector{Int}

Returns an ordered list of node labels for the code, corresponding to the qubits and virtual nodes.

source
TensorNetworkCodes.num_nodesFunction
num_nodes(code::TensorNetworkCode) -> Int

Returns the number of nodes in the code, which is the sum of the number of qubits and the number of virtual nodes.

source
TensorNetworkCodes.set_coords!Method
set_coords!(
    code::TensorNetworkCode,
    new_coords::AbstractVector{<:AbstractVector{<:Real}}
)

Assign new coordinates to all (physical and virtual) nodes of the code, where the order of the coordinates matches that of the nodes returned by nodes, i.e. in ascending order.

source
TensorNetworkCodes.shift_coords!Method
shift_coords!(code::TensorNetworkCode, shift::AbstractVector{<:Real})

Shift the coordinates of all (physical and virtual) nodes of the code by the given shift.

source

Generic getters / setters