Node

Definitions of node types.

This module provides definitions for various types of quantum network nodes. All node types inherit from the base Node type, which inherits from Entity. Node types can be used to collect all the necessary hardware and software for a network usage scenario.

class sequence.topology.node.BSMNode(name: str, timeline: Timeline, other_nodes: list[str], seed=None, component_templates=None)

Bell state measurement node.

This node provides bell state measurement and the EntanglementGenerationB protocol for entanglement generation. Creates a SingleAtomBSM object within local components.

name

label for node instance.

Type:

str

timeline

timeline for simulation.

Type:

Timeline

eg

entanglement generation protocol instance.

Type:

EntanglementGenerationB

eg_add_others(other)

Method to add other protocols to entanglement generation protocol.

Local entanglement generation protocol stores name of other protocol for communication. NOTE: entanglement generation protocol should be first protocol in protocol list.

Parameters:

other (EntanglementProtocol) – other entanglement protocol instance.

receive_message(src: str, msg: Message) None

Method to receive message from classical channel.

Searches through attached protocols for those matching message, then invokes received_message method of protocol(s).

Parameters:
  • src (str) – name of node sending the message.

  • msg (Message) – message transmitted from node.

class sequence.topology.node.ClassicalNode(name: str, timeline: Timeline, seed: int = None)

Base node type that has only classical capabilties.

Provides default interfaces for network.

name

label for node instance.

Type:

str

timeline

timeline for simulation.

Type:

Timeline

cchannels

mapping of destination node names to classical channel instances.

Type:

dict[str, ClassicalChannel]

protocols

list of attached protocols.

Type:

list[Protocol]

generator

random number generator used by node.

Type:

np.random.Generator

assign_cchannel(cchannel: ClassicalChannel, another: str) None

Method to assign a classical channel to the node.

This method is usually called by the ClassicalChannel.set_ends method and not called individually.

Parameters:
  • cchannel (ClassicalChannel) – channel to add.

  • another (str) – name of node at other end of channel.

get_generator() Generator

Method to get random generator of parent node.

If entity is not attached to a node, return default generator.

init() None

Method to initialize entity (abstract).

Entity init methods are invoked for all timeline entities when the timeline is initialized. This method can be used to perform any necessary functions before simulation.

receive_message(src: str, msg: Message) None

Method to receive message from classical channel.

Searches through attached protocols for those matching message, then invokes received_message method of protocol(s).

Parameters:
  • src (str) – name of node sending the message.

  • msg (Message) – message transmitted from node.

send_message(dst: str, msg: Message, priority=inf) None

Method to send classical message.

Parameters:
  • dst (str) – name of destination node for message.

  • msg (Message) – message to transmit.

  • priority (int) – priority for transmitted message (default inf).

class sequence.topology.node.DQCNode(name: str, timeline: Timeline, memo_size: int = 1, seed: int = None, component_templates: dict = {}, gate_fid: float = 1, meas_fid: float = 1, data_memo_size: int = 1)

Code for DQCNode class – node that supports Distributed Quantum Computing

It is inherited from the QuantumRouter class so that DQCNode can do all what a QuantumRouter can do, such as routing.

name

Name of the quantum node.

Type:

str

timeline

The timeline for scheduling operations.

Type:

Timeline

seed

the seed of the this node’s random number generator.

Type:

int

component_templates

templates for the components of this node.

Type:

dict

gate_fid

fidelity of gate operations (default is 1).

Type:

float

meas_fid

fidelity of measurement operations (default is 1).

Type:

float

memo_arr_name

name of the communication memory array.

Type:

str

resource_manager

resource management module.

Type:

ResourceManager

network_manager

network management module.

Type:

NetworkManager

map_to_middle_node

mapping of router names to intermediate bsm node names.

Type:

dict[str, str]

app

application in use on node.

Type:

any

data_memo_arr_name

name of the data memory array.

Type:

str

teleport_app

The teleportation application instance.

Type:

TeleportApp

teledata_app

The teledata application instance.

Type:

TeledataApp

telegate_app

The telegate application instance.

Type:

TelegateApp

receive_message(src: str, msg: Message) None

Determine what to do when a message is received, based on the msg.receiver.

Parameters:
  • src (str) – name of node that sent the message.

  • msg (Message) – the received message.

class sequence.topology.node.Node(name: str, timeline: Timeline, seed=None, gate_fid: float = 1, meas_fid: float = 1)

Base node type that has both classical and quantum capabilties.

Provides default interfaces for network.

name

label for node instance.

Type:

str

timeline

timeline for simulation.

Type:

Timeline

cchannels

mapping of destination node names to classical channel instances.

Type:

dict[str, ClassicalChannel]

qchannels

mapping of destination node names to quantum channel instances.

Type:

dict[str, QuantumChannel]

protocols

list of attached protocols.

Type:

list[Protocol]

generator

random number generator used by node.

Type:

np.random.Generator

components

mapping of local component names to objects.

Type:

dict[str, Entity]

first_component_name

name of component that first receives incoming qubits.

Type:

str

gate_fid

fidelity of multi-qubit gates (usually CNOT) that can be performed on the node.

Type:

float

meas_fid

fidelity of single-qubit measurements (usually Z measurement) that can be performed on the node.

Type:

float

add_component(component: Entity) None

Adds a hardware component to the node.

Parameters:

component (Entity) – local hardware component to add.

assign_cchannel(cchannel: ClassicalChannel, another: str) None

Method to assign a classical channel to the node.

This method is usually called by the ClassicalChannel.set_ends method and not called individually.

Parameters:
  • cchannel (ClassicalChannel) – channel to add.

  • another (str) – name of node at other end of channel.

assign_qchannel(qchannel: QuantumChannel, another: str) None

Method to assign a quantum channel to the node.

This method is usually called by the QuantumChannel.set_ends method and not called individually.

Parameters:
  • qchannel (QuantumChannel) – channel to add.

  • another (str) – name of node at other end of channel.

get_component_by_name(name: str) Entity | None

Method to return the component with the given name.

Parameters:

name (str) – The name of the component to retrieve.

Returns:

The component with the given name, or None if not found.

Return type:

Optional[Entity]

get_components_by_type(component_type: str | type) list

Method to return all components of a specific type. :param component_type: The type of components to filter for. :type component_type: str/type

Returns:

A list of components matching the requested type.

Return type:

list

get_generator() Generator

Method to get random generator of parent node.

If entity is not attached to a node, return default generator.

init() None

Method to initialize entity (abstract).

Entity init methods are invoked for all timeline entities when the timeline is initialized. This method can be used to perform any necessary functions before simulation.

receive_message(src: str, msg: Message) None

Method to receive message from classical channel.

Searches through attached protocols for those matching message, then invokes received_message method of protocol(s).

Parameters:
  • src (str) – name of node sending the message.

  • msg (Message) – message transmitted from node.

receive_qubit(src: str, qubit) None

Method to receive qubits from quantum channel.

By default, forwards qubit to hardware element designated by field receiver_name.

Parameters:
  • src (str) – name of node where qubit was sent from.

  • qubit (any) – transmitted qubit. Typically a Photon object.

schedule_qubit(dst: str, min_time: int) int

Interface for quantum channel schedule_transmit method.

send_message(dst: str, msg: Message, priority=inf) None

Method to send classical message.

Parameters:
  • dst (str) – name of destination node for message.

  • msg (Message) – message to transmit.

  • priority (int) – priority for transmitted message (default inf).

send_qubit(dst: str, qubit) None

Interface for quantum channel transmit method.

set_first_component(name: str)

set the name of component that first receives incoming qubits.

Parameters:

name (str) – the name of component that first receives incoming qubits.

class sequence.topology.node.QKDNode(name: str, timeline: Timeline, encoding={'bases': [((1 + 0j, 0j), (0j, 1 + 0j)), ((0.7071067811865476 + 0j, 0.7071067811865476 + 0j), (-0.7071067811865476 + 0j, 0.7071067811865476 + 0j))], 'name': 'polarization'}, stack_size=5, seed=None, component_templates=None)

Node for quantum key distribution.

QKDNodes include a protocol stack to create keys. The protocol stack follows the “BBN QKD Protocol Suite” introduced in the DARPA quantum network (https://arxiv.org/pdf/quant-ph/0412029.pdf page 24). The protocol stack is:

4. Authentication <= No implementation 3. Privacy Amplification <= No implementation 2. Entropy Estimation <= No implementation 1. Error Correction <= implemented by cascade 0. Sifting <= implemented by BB84

Additionally, the components dictionary contains the following hardware:

  1. lightsource (LightSource): laser light source to generate keys.

  2. qsdetector (QSDetector): quantum state detector for qubit measurement.

name

label for node instance.

Type:

str

timeline

timeline for simulation.

Type:

Timeline

encoding

encoding type for qkd qubits (from encoding module).

Type:

dict[str, Any]

destination

name of destination node for photons

Type:

str

protocol_stack

protocols for QKD process.

Type:

list[StackProtocol]

get(photon: Photon, **kwargs)

Method for an entity to receive a photon.

If entity is a node, may forward to external quantum channel. Must be overwritten to be used, or will raise exception.

Parameters:
  • photon (Photon) – photon received by the entity.

  • **kwargs – other arguments required by a particular hardware component.

get_bits(light_time: int, start_time: int, frequency: float, detector_name: str)

Method for QKD protocols to get received qubits from the node.

Uses the detection times from attached detectors to calculate which bits were received. Returns 0/1 for successfully transmitted bits and -1 for lost/ambiguous bits.

Parameters:
  • light_time (int) – time duration for which qubits were transmitted.

  • start_time (int) – time at which qubits were first received.

  • frequency (float) – frequency of qubit transmission.

  • detector_name (str) – name of the QSDetector measuring qubits.

Returns:

list of calculated bits.

Return type:

list[int]

init() None

Method to initialize entity (abstract).

Entity init methods are invoked for all timeline entities when the timeline is initialized. This method can be used to perform any necessary functions before simulation.

receive_message(src: str, msg: Message) None

Method to receive message from classical channel.

Searches through attached protocols for those matching message, then invokes received_message method of protocol(s).

Parameters:
  • src (str) – name of node sending the message.

  • msg (Message) – message transmitted from node.

set_bases(basis_list: list[int], start_time: int, frequency: float, component_name: str)

Method to set basis list for measurement component.

Parameters:
  • basis_list (list[int]) – list of bases to measure in.

  • start_time (int) – time to start measurement.

  • frequency (float) – frequency with which to measure.

  • component_name (str) – name of measurement component to edit (normally a QSDetector).

set_protocol_layer(layer: int, protocol: StackProtocol) None

Method to set a layer of the protocol stack.

Parameters:
  • layer (int) – layer to change.

  • protocol (StackProtocol) – protocol to insert.

class sequence.topology.node.QuantumRouter(name: str, tl: Timeline, memo_size: int = 50, seed: int | None = None, component_templates: dict = {}, gate_fid: float = 1, meas_fid: float = 1)

Node for entanglement distribution networks.

This node type comes pre-equipped with memory hardware, along with the default SeQUeNCe modules (sans application). By default, a quantum memory array is included in the components of this node.

name

name of the node.

Type:

str

timeline

timeline for simulation.

Type:

Timeline

seed

the seed for the random number generator.

Type:

int

component_templates

templates for the components of this node.

Type:

dict

gate_fid

fidelity of multi-qubit gates (usually CNOT) that can be performed on the node.

Type:

float

meas_fid

fidelity of single-qubit measurements (usually Z measurement) that can be performed on the node.

Type:

float

memo_arr_name

name of the communication memory array.

Type:

str

resource_manager

resource management module.

Type:

ResourceManager

network_manager

network management module.

Type:

NetworkManager

map_to_middle_node

mapping of router names to intermediate bsm node names.

Type:

dict[str, str]

app

application in use on node.

Type:

any

down

whether the node is down (not operational).

Type:

bool

add_bsm_node(bsm_name: str, router_name: str)

Method to record connected BSM nodes

Parameters:
  • bsm_name (str) – the BSM node between nodes self and router_name.

  • router_name (str) – the name of another router connected with the BSM node.

get(photon: Photon, **kwargs)

Receives photon from last hardware element (in this case, quantum memory).

Parameters:

photon (Photon) – the received photon.

get_idle_memory(info: MemoryInfo) None

Method for application to receive available memories.

Parameters:

info (MemoryInfo) – information about the available memory.

get_other_reservation(reservation: Reservation)

Method for application to add the approved reservation that is requested by other nodes

Parameters:

reservation (Reservation) – the reservation created by the other node (this node is the responder)

get_reservation_result(reservation: Reservation, result: bool) None

Method for application to receive reservations results

Parameters:
  • reservation (Reservation) – the reservation created by the reservation protocol at this node (the initiator).

  • result (bool) – whether the reservation has been approved by the responder.

init()

Method to initialize quantum router node.

memory_expire(memory: Memory) None

Method to receive expired memories.

Parameters:

memory (Memory) – memory that has expired.

receive_message(src: str, msg: Message) None

Determine what to do when a message is received, based on the msg.receiver.

Parameters:
  • src (str) – name of node that sent the message.

  • msg (Message) – the received message.

reserve_net_resource(responder: str, start_time: int, end_time: int, memory_size: int, target_fidelity: float, entanglement_number: int = 1, identity: int = 0) None

Method to request a reservation.

Can be used by local applications.

Parameters:
  • responder (str) – name of the node with which entanglement is requested.

  • start_time (int) – desired simulation start time of entanglement.

  • end_time (int) – desired simulation end time of entanglement.

  • memory_size (int) – number of memories requested.

  • target_fidelity (float) – desired fidelity of entanglement.

  • entanglement_number (int) – the number of entanglement that the request ask for (default 1).

  • identity (int) – the ID of the request (default 0).

send_message(dst: str, msg: Message, priority=inf) None

Method to send a classical message.

Parameters:
  • dst (str) – name of the destination node to get the message.

  • msg (Message) – message to transmit.

  • priority (int) – priority for the transmitted message (default inf).

set_app(app: RequestApp)

Method to add an application to the node. NOTE: a quantum router can only have one application at a time.

Parameters:

app (RequestApp) – the application to add.

set_down(down: bool)

Method to set the node status.

Parameters:

down (bool) – whether the node is down (not operational).