Skip to main content

Tutorial 7 — Teleportation with a Relay Node

Objective: Teleport a quantum state across a multi-hop path using an intermediate relay node via the execute_teleportation() protocol.

Quantum teleportation uses entanglement as a resource to transfer an unknown quantum state from a source to a target. In qnet-core, you can specify explicit relay nodes to bridge distances where direct fidelity would be too low.

Define a 3-Node Chain

from qnet_core import QNetEngine, NodeDefinition, LinkDefinition, TeleportationParameters

engine = QNetEngine()

nodes = [
NodeDefinition(id="Alice", memory_lifetime_t2=1.0), # source (sender)
NodeDefinition(id="Charlie", memory_lifetime_t2=0.8), # relay node
NodeDefinition(id="Bob", memory_lifetime_t2=1.0), # target (receiver)
]

links = [
LinkDefinition("Alice", "Charlie", distance_km=25.0, base_fidelity=0.90,
generation_rate_hz=500.0),
LinkDefinition("Charlie", "Bob", distance_km=25.0, base_fidelity=0.90,
generation_rate_hz=500.0),
]

engine.define_network(nodes, links)

Configure and Execute Teleportation

teleport_params = TeleportationParameters(
source_node="Alice",
target_node="Bob",
state_fidelity=0.95, # desired output state fidelity
classical_bandwidth_ms=100.0, # time for classical channel communication
)

# Explicitly specify the relay node to bridge the two hops
teleport_params.relay_nodes = ["Charlie"]

outcome = engine.execute_teleportation(teleport_params)

print("=== Quantum State Teleportation ===")
print(f"Success: {outcome.success}")
print(f"Teleportation fidelity: {outcome.teleportation_fidelity:.4f}")
print(f"Resource entanglement fidelity: {outcome.resource_entanglement_fidelity:.4f}")
print(f"Latency: {outcome.latency_ms:.1f} ms")
print(f"Path: {' → '.join(outcome.path)}")
print(f"Classical bits sent: {outcome.classical_bits_transferred}")

Result Fields

FieldTypeDescription
successboolWhether teleportation succeeded
teleportation_fidelityfloatFidelity of the teleported state (how close to input)
resource_entanglement_fidelityfloatFidelity of the resource entanglement links used
latency_msfloatEnd-to-end latency (entanglement + classical communication)
pathList[str]Node IDs traversed during the protocol
classical_bits_transferredintNumber of classical bits transmitted via the relay

Compare: Direct vs Relayed

# Direct attempt (single long hop, lower fidelity)
direct_links = [
LinkDefinition("Alice", "Bob", distance_km=50.0, base_fidelity=0.75,
generation_rate_hz=300.0),
]
engine_direct = QNetEngine()
engine_direct.define_network(
[NodeDefinition(id="Alice", memory_lifetime_t2=1.0),
NodeDefinition(id="Bob", memory_lifetime_t2=1.0)],
direct_links,
)

direct_params = TeleportationParameters(
source_node="Alice", target_node="Bob",
state_fidelity=0.95, classical_bandwidth_ms=100.0,
)
# No relay nodes — single long hop

direct_outcome = engine_direct.execute_teleportation(direct_params)

print(f"Direct — success: {direct_outcome.success}, fidelity: {direct_outcome.teleportation_fidelity:.4f}")
print(f"Relayed — success: {outcome.success}, fidelity: {outcome.teleportation_fidelity:.4f}")
print("\n=> Relayed teleportation trades latency for higher output fidelity.")

Teleportation Protocol Flow

  1. Resource entanglement — establish entangled pairs across the path (including relay links)
  2. Bell-state measurement — source performs BSM on input state + local entangled pair
  3. Classical communication — send BSM results through the classical channel
  4. Unitary correction — target applies corrections based on received classical bits
TeleportationStats (Planned)

The TeleportationStats Monte Carlo ensemble type is planned but not yet implemented. Call execute_teleportation() repeatedly in your own loop for statistics.

What's next