Q2NS dev
ns-3 module
Loading...
Searching...
No Matches
q2nsviz-ghz-distribution-example.cc File Reference

GHZ state generation and distribution across 4 nodes. More...

#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/simulator.h"
#include "ns3/q2ns-netcontroller.h"
#include "ns3/q2ns-qgate.h"
#include "ns3/q2ns-qnode.h"
#include "ns3/q2ns-qubit.h"
#include "ns3/q2nsviz-trace-writer.h"
#include "ns3/q2nsviz-trace.h"
#include <atomic>
#include <iostream>
Include dependency graph for q2nsviz-ghz-distribution-example.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

static const uint16_t kAckPort = 9100
 

Detailed Description

GHZ state generation and distribution across 4 nodes.

Node1 locally prepares a 4-qubit GHZ state:

|GHZ> = (|0000> + |1111>) / sqrt(2)

using a Hadamard gate on q0 followed by three sequential CNOT(q0, qi) for i in {1,2,3} (serialized because all share q0 as control). It then keeps q0 and distributes q1->Node2, q2->Node3, q3->Node4 over quantum links, completing the shared entangled resource.

Timing model (illustrative, platform-neutral): kSingleGate = 100 ns (single-qubit gate) kTwoQGate = 300 ns (two-qubit gate) kQDelay = 100 ns (quantum channel propagation, ~20 m fiber)

Visualization output is written to examples/example_traces/q2nsviz-ghz-distribution-example.json and can be loaded in the q2nsviz viewer (src/q2ns/utils/q2nsviz-serve.sh).

See docs/tutorials/tutorial-00.md for a detailed walkthrough.

Definition in file q2nsviz-ghz-distribution-example.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file q2nsviz-ghz-distribution-example.cc.

References q2ns::NetController::CreateNode(), q2ns::NetController::InstallQuantumLink(), TraceWriter::Instance(), kAckPort, TraceWriter::Open(), q2ns::NetController::SetQStateBackend(), Trace(), TraceCreateChannel(), and TraceCreateNode().

Here is the call graph for this function:

Variable Documentation

◆ kAckPort

const uint16_t kAckPort = 9100
static

Definition at line 54 of file q2nsviz-ghz-distribution-example.cc.

Referenced by main().