progress.pqnet.dag
- class progress.pqnet.dag.DAG(nodes, edges)[source]
Bases:
object
This class is a representation of a Directed Acyclic Graph (DAG), where each node is assigned with an instance of the class
Module
. The DAG is used to represent the input/output relationship between modules, that determines the order in which the modules process the tokens.- Parameters:
- nodesdict[str,
Module
] A dictionary that maps the name of each node to its corresponding module.
- edgeslist[tuple[str, str]]
A list of tuples, where each tuple represents an edge in the DAG. The order of the tuple is important, as it determines the direction of the edge.
- nodesdict[str,
Notes
- The Ports of the wrapping node are:
- “token_in_[0..roots]”: The input port for tokens from the i-th QNIC. Tokens are delivered to the i-th root of
the DAG. The i-th root is the i-th node in nodes that has no predecessors.
“messages”: The input/output port for classical messages.
“tokens_ops_in”: The input port for responses from the quantum hardware for operations on the tokens.
- Attributes:
- wrapping_node
netsquid.nodes.Node
A
netsquid.nodes.Node
that wraps the DAG. This node is used to connect the DAG to the rest of the components of the quantum network device.
- wrapping_node
- get_nodes()[source]
Get a list of the nodes of the DAG, where each element is the module identifier.
- Returns:
- list[str]
- wrapping_node
A
netsquid.nodes.Node
that wraps the DAG. This node is used to connect the DAG to the rest of the components of the device.Notes
The ports of this node are: 1. token_in_[0..roots]: The input port for tokens of the i-th root of the DAG.
The i-th root is the i-th node in nodes that has no predecessors.
messages: The input/output port for classical messages.
tokens_ops_in: The input port for responses from the quantum hardware for operations on the tokens.
- class progress.pqnet.dag.DAGFactory(edges, module_behaviors, device_id)[source]
Bases:
object
This class is a factory that creates a DAG from a list of edges and a dictionary of
ModuleBehavior
classes.- Parameters:
- edgeslist[tuple[str, str]]
A list of tuples, where each tuple represents an edge in the DAG. The order of the tuple is important, as it determines the direction of the edge.
- module_behaviorsdict[str, tuple(
class
, dict)] A dictionary mapping the name of each module to a tuple of the module behavior class and a dictionary of the parameters to pass to the constructor of the module class. The dictionary must have keys that are numerical strings, so that they can be used to derive the module id. Roots of the DAG must have the optional integer parameter “qnic” to link them to the specific token queue from the QHAL.
- class progress.pqnet.dag.DAGMessagesSwitch(dag, name=None)[source]
Bases:
Switch
This class abstracts a virtual switch that routes incoming messages to the correct module in the DAG using module_id as routing key. It also acts as a multiplexer for all outgoing messages from bricks in the DAG.
- Parameters:
- dag
DAG
The DAG that the switch is associated with.
- namestr or None, optional
The name of the switch instance. If None, a default name is used. Defaults to None.
- dag