quantumnet Quantum Entanglement Link · reference
python 3.11+ runtime dep numpy version 0.1.0 repository

Quantum Entanglement Link

quantumnet — a quantum communication network simulation stack

A quantum link fails quietly. Fidelity leaks away through noise, distance and the time spent waiting in memory, and a route that looks short can arrive too degraded to extract a key from. quantumnet simulates the whole path — density-matrix states, noise channels, swapping, memory decay — and reports the fidelity that survives it. This page is the reference: what each module does, what each command returns, and where the simulation stops.

§1The problem

A classical mesh asks which path a packet takes. A quantum one has to answer a harder question before anything moves: where do the repeaters go, and what fidelity is left when the entanglement arrives?

Entanglement cannot be copied, so it cannot be cached and re-sent. It is created between two nodes, consumed by a Bell-state measurement to extend the link further, and degraded the whole time it waits in memory. A repeater chain is therefore only as good as its worst link, and the arithmetic of the chain decides whether a route is usable at all.

Hardware cannot answer that question cheaply. A simulator can, and it can answer it for a thousand topologies before anyone books lab time.

§2What it models

States are density matrices, so decoherence is modelled directly rather than implied. Each channel acts on the state, and the metrics that matter for routing — fidelity and entropy — are read back from it rather than tracked separately.

ChannelEffectWhere it applies
depolarisingLoss of polarisation toward the maximally mixed stateGeneric link error
dephasingLoss of phase coherence with no energy changeMemory T2
amplitude dampingRelaxation toward the ground stateMemory T1, spontaneous emission
attenuationDistance-dependent loss on a linkTopology edges
measurementProjective or POVM, with state collapseBell-state measurement at a repeater

Estimators

Noise is characterised on the captured window rather than assumed from a datasheet. The estimator ordering H_90B ≥ H_hist ≥ H_Shannon is checked in the validation suite, which is what makes the reported fidelity trustworthy at the pessimistic end.

§3Modules

ModuleResponsibility
core — primitives
qubitDensity-matrix states, fidelity and entropy metrics
gateUnitary gates, Pauli algebra, multi-qubit tensor products
measurementProjective and POVM measurement with state collapse
noiseDepolarising, dephasing and amplitude-damping channels
channelQuantum and classical links with distance-dependent attenuation
physicalFibre and hardware impairments mapped to an attenuation budget
stabilizerClifford tableau simulation under Gottesman–Knill
schedulerAsynchronous discrete-event core
ipc_nodeOne operating-system process per network node
protocols — ten implemented
bb84QKD with basis reconciliation, QBER estimation and an intercept-resend eavesdropper
e91Ekert entanglement-based QKD, security from Bell inequality violation
bellBell-state preparation, Bell measurement, CHSH inequality tests
teleportationUnknown state moved over a shared EPR pair plus two classical bits
superdenseTwo classical bits carried by one qubit
swappingEntanglement extended between nodes that never interacted
distillationBBPSSW and Deutsch purification rounds
memoryBuffer dynamics with T1 relaxation and T2 dephasing
shorNine-qubit code: encoding, syndrome measurement, recovery
steaneSeven-qubit CSS code, correcting bit and phase flips
topology — placement and routing
graphNodes, optical links and per-edge fidelity models
routingFidelity-constrained entanglement routing over Bell-state swaps
scheduleTime-aware entanglement distribution plan
visualizeDependency-free ASCII rendering of a topology and a route
ghostnetImport a live Global Ghost Net topology export and route over it

§4Commands

Fifteen commands, dispatched by py -m quantumnet. The protocol demos write to stdout; the bridge commands emit exactly one JSON document on stdout and keep everything else on stderr, so they compose in a pipeline.

CommandWhat it does
protocol demonstrations
bb84Run a key exchange and report the QBER with and without an eavesdropper
e91Run the Ekert protocol and report the CHSH value
teleportTeleport a state and report the reconstructed fidelity
superdenseEncode and decode two classical bits through one qubit
swapExtend entanglement across an intermediate node
shorInject an error into the nine-qubit code and recover it
steaneThe same for the seven-qubit CSS code
distillRun purification rounds and report purity gained per pair spent
memoryHold a state in the buffer and report fidelity against time
allEvery demonstration in sequence
simulation and routing
stabilizerClifford tableau simulator for circuits too large to track as vectors
physicalTurn fibre and hardware metrics into an attenuation budget
topologyBuild a graph, route entanglement across it, render ASCII; --max-hops is bounded to 1–8
ghost-netRoute over a live mesh topology export and emit the route as one JSON document
qkd-deriveDerive key material at an explicit fidelity and seed, with no routing
# route entanglement across a live mesh export
py -m quantumnet ghost-net --topology mesh.json
{"route": [0, 4, 9, 11], "fidelity": 0.941, "distilled": true, "hops": 3}

# key material at an explicit fidelity
py -m quantumnet qkd-derive --fidelity 0.94 --out key.bin

# a topology, routed and rendered as ASCII
py -m quantumnet topology --nodes 12 --route 0 11

§5Ghost-Net bridge

topology/ghostnet.py imports a topology export from Global Ghost Net and routes entanglement across exactly the nodes it describes, so the same map that carries packets decides where quantum links could exist.

A route's end-to-end fidelity is the scheduled value once every swap and every memory hold on the path is accounted for. If that value is too low for QKD to extract a key, the route is distilled — BBPSSW rounds over 256 pairs — until it clears the threshold. Then a real BB84 exchange runs at the route's own noise level and produces the key material.

Input
A topology export: node identifiers and the links between them
Route cost
Fidelity after swaps, memory decay and optional distillation
Output
One JSON document: route, end-to-end fidelity, whether distillation was needed, hop count
Key material
32 bytes, derived at the route's fidelity from a stated seed

§6Scope and limits

Real
The quantum mechanics: states, gates, measurement collapse, noise channels, the stabilizer formalism, the error-correcting codes, distillation, and the fidelity arithmetic.
Modelled
The hardware and the network. There are no photons, no fibre and no sockets. ipc_node uses real processes; the links between them are modelled.
Not claimed
These are simulator results and do not predict what physical hardware would achieve.

§7Tests

git clone https://github.com/KELLERBABG/QEL
cd QEL
py -m pip install -e ".[dev]"

py -m pytest -q        # about 80 seconds
py -m quantumnet all   # every protocol demo

The suite covers each module directly: gates and measurement, the noise channels, the estimator ordering, each protocol against its closed-form expectation, routing and scheduling, and the JSON bridge contract. Run it before trusting a number on this page.