Skip to main content

Tutorial 8 — Distributed Quantum Computing (Star Topology)

Objective: Run a 3-party GHZ-basis computation using CoordinationTopology.star() and inspect per-party measurement outcomes.

Distributed quantum computing allows multiple parties to perform coordinated measurements across a network. In the star topology, a central coordinator collects results from all participants before performing the final computation.

Define the Star Network

from qnet_core import (
QNetEngine, NodeDefinition, LinkDefinition,
CoordinationTopology, MeasurementBasis, BasisType,
)

engine = QNetEngine()

nodes = [
NodeDefinition(id="Center", memory_lifetime_t2=1.0), # coordinator
NodeDefinition(id="PartyA", memory_lifetime_t2=0.8), # participant
NodeDefinition(id="PartyB", memory_lifetime_t2=0.8), # participant
NodeDefinition(id="PartyC", memory_lifetime_t2=0.8), # participant
]

links = [
LinkDefinition("Center", "PartyA", distance_km=10.0, base_fidelity=0.95, generation_rate_hz=1_000.0),
LinkDefinition("Center", "PartyB", distance_km=10.0, base_fidelity=0.95, generation_rate_hz=1_000.0),
LinkDefinition("Center", "PartyC", distance_km=10.0, base_fidelity=0.92, generation_rate_hz=800.0),
]

engine.define_network(nodes, links)

Configure and Execute

participants = ["PartyA", "PartyB", "PartyC"]

# Create star topology with "Center" as the coordinator
coordination = CoordinationTopology.star(center_node="Center")

# GHZ measurement basis with strong correlations
basis = MeasurementBasis(basis_type=BasisType.GHZ, correlation_strength=0.85)

result = engine.run_distributed_computation(
participants=participants,
coordination_topology=coordination,
measurement_basis=basis,
classical_relay_latency_ms=5.0, # time for coordinator to collect results
)

print("=== Distributed Quantum Computing (Star Topology) ===")
print(f"Success: {result.success}")
print(f"Computation fidelity: {result.computation_fidelity:.4f}")
print(f"Total latency: {result.total_latency_ms:.1f} ms")
print(f"Coordination overhead: {result.coordination_overhead_ms:.1f} ms")

print("\nResource links used:")
for link in result.resource_links_used:
print(f" - {link}")

print("\nParty outcomes:")
for party in result.party_results:
status = "OK" if party.successful_measurement else "FAIL"
print(f" [{status}] {party.node_id}: local_fidelity={party.local_fidelity:.4f}")

Key Classes Reference

CoordinationTopology — Static Methods

MethodDescription
.star(center_node)Star topology with designated center coordinator
.ring()Ring topology (circular coordination)
.mesh()All-to-all mesh topology
.arbitrary(edges)Custom edge list [(src, dst), ...]

MeasurementBasis

FieldTypeDefaultDescription
basis_typeBasisTypeGHZGHZ / Cluster / GraphGraph measurement basis
correlation_strengthfloat0.85Strength of quantum correlations [0, 1]

Result Fields

FieldTypeDescription
successboolWhether the computation completed successfully
computation_fidelityfloatFidelity of the distributed result
party_resultsList[PartyOutcome]Per-party measurement outcomes
resource_links_usedList[str]Links consumed during the protocol
total_latency_msfloatEnd-to-end latency including coordination overhead
coordination_overhead_msfloatLatency added by the coordination protocol itself

What's next