# A Dynamic-Routing Algorithm Based on a Virtual Quantum Key Distribution Network
## 2 Technical Foundation
### Blocking Probabilities and Thresholds  
In QKD systems, link nodes are an essential component. This is because link nodes typically connect multiple quantum devices to exchange and process quantum information. And in the QKD framework, trusted relays and QKP link nodes are the basic units that form the quantum communication network. At the same time, QKP needs link nodes to ensure that the transmission and processing of quantum states during key distribution can be carried out smoothly. In summary, the contribution of link nodes to the QKD dynamic routing algorithm is to optimize the routing in the QKD network to improve the security and efficiency of the system. Figure 4 shows the link node topology. Link nodes play an essential role in quantum communication networks, including quantum state transmission, quantum entanglement distribution, quantum channel establishment, quantum relaying, and error correction [40]. They must maintain the coherence and accuracy of the quantum states and ensure the reliable transmission of entangled quantum states. Link nodes must also establish dedicated quantum channels, employing appropriate quantum error correction and distribution protocols to resist noise and loss. In addition, link nodes can act as quantum relay stations, extending the communication distance and connecting multiple nodes. They also need to implement quantum error correction techniques to improve the reliability and fault tolerance of the overall network. If a node blocks or crashes, it can affect the stability and availability of the entire system. Therefore, selecting nodes with a low probability of blocking can reduce the likelihood of system failure, increase system throughput and allow the system to better handle large volumes of requests and data. If specific nodes are prone to blocking, this may lead to an unbalanced load on the system, thus reducing its flexibility. Nodes in a QKD network are prone to blocking, usually because they have much higher incoming and outgoing traffic than other nodes. The blocking probability of each node can be calculated using the following formula:  
\[P_{i}=\frac{X_{i}}{\sum_{j=1}^{m}X_{j}} \tag{7}\]  
where \(P_{i}\) denotes the blocking probability of the node, and \(X_{i}\) represents that node's incoming and outgoing traffic. Using this formula, each node's blocking probability can be obtained to determine which nodes have a low blocking chance. The nodes with low blocking probability can be prioritized when making routing decisions, reducing network delays and blocking. Suppose we know the blocking probability of a node in a network to be \(P_{i}\) and require the link probability \(P_{ij}\) from that node to another node, which can be calculated using the conditional probability formula:  
\[P_{ij}(A|B)=\frac{P(A\cap B)}{P(B)} \tag{8}\]  
\(P_{ij}(A|B)\) indicates the probability of event \(A\) under the premise of event \(B\). For the problem in this paper, we can define event \(B\) as \"all paths from the source node to the target node\", and then \(P(B)\) is the sum of the probabilities of all links from the source node to the target node. While event \(A\) can be defined as \"a specific path from the source node to the target node\", then \(P(A\cap B)\) is the probability of the specific link. In order to track the blocking level more accurately to ensure reliability and continuity of communication, we need to make the following assumptions: link-blocking events are independent, and their occurrence conforms to a Poisson process, i.e., the arrival times of link-blocking events follow an exponential distribution. Where the frequency of link-blocking events is \(\lambda\), i.e., the average number of times a link-blocking event occurs per unit of time. The probability mass function of the Poisson distribution can be expressed as:  
\[P(X=m)=\left(e^{\lambda}(-\lambda)\times\lambda^{\wedge}m\right)/m! \tag{9}\]  
\(X\) denotes the number of link-blocking events per unit of time, and \(m\) represents the number of specific events.