Curriculum / Quantum Networking / Simulating a Quantum Network

Lesson 9 of 18Code challengePro+175 XP

Simulating a Quantum Network

Build a multi-node quantum network simulation and compute end-to-end key rates.

Simulating a Quantum Network

Quantum network simulation allows testing protocols without expensive hardware. This exercise implements a discrete-event simulation of a simple quantum network: a repeater chain with quantum memory, modeling decoherence, entanglement generation, and swapping.

Simulation Model

The network consists of nodes connected by fiber links. Each simulation "tick" represents one clock cycle. Events in each cycle:

  1. 1.Entanglement attempts: Each link attempts to generate a Bell pair. Success probability depends on fiber transmissivity and detector efficiency.
  1. 2.Memory decoherence: Stored qubits lose fidelity over time according to the T₂ decay model.
  1. 3.Swapping: When a node has entangled pairs on both sides (and memory is still coherent enough), it performs an entanglement swap to extend the range.
  1. 4.Purification: When multiple pairs of sufficient fidelity are available, purification is triggered.

Decoherence Model

Quantum memory fidelity decays exponentially with storage time:

F(t) = 0.25 + (F₀ - 0.25) × exp(-wait_time / T₂)

This is the Werner state decoherence model: fidelity decays from the initial F₀ toward the minimum value (0.25 = completely mixed state) with characteristic time T₂.

Network Performance Metrics

End-to-end entanglement rate: How many Bell pairs per second are delivered between end nodes. The key output metric.

End-to-end fidelity: Average fidelity of delivered pairs. Determines usefulness for QKD or computation.

Memory utilization: How often quantum memories are occupied. High utilization means the network is near capacity.

Your Challenge

Implement the fidelity_after_decoherence function using the Werner state decay model, and the attempt_link_entanglement function that models probabilistic photon transmission. Then run the simulation loop and observe how decoherence degrades pair fidelity as memory wait times increase.

Memory Wait Time Is the Key Bottleneck

In quantum network simulation, the most important insight is usually that memory wait time, not transmission, dominates decoherence. A photon traveling 50 km of fiber arrives in 250 microseconds. But entanglement swapping requires both adjacent links to be established, which at 50% success probability each takes on average 2 clock cycles of waiting. Each wait cycle costs fidelity. This is why high-rate entanglement generation and fast memory read/write are critical.

How this lesson works

A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.

Part of: Quantum Networking

Build quantum networks from the ground up, entanglement distribution, quantum repeaters, the quantum internet, and satellite-based QKD.

This lesson is part of Pro

Unlock Quantum Networking and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.