---
# System prepended metadata

title: Swap Score

---



For a path segment $x - y - z$, the swap score of node $y$ is the expected number of end-to-end entangled pairs created between $x$ and $z$ after swapping at $y$:

$$
S_y = \mathbb{E}[E_{x,z}] = \sum_k k \, p_k(x,z)
$$

Given $i$ pairs on $(x,y)$ and $j$ on $(y,z)$, at most $\min(i,j)$ swaps are possible.

With swap success probability $q_y$:

$$
p_k(x,z \mid i,j) =
\binom{\min(i,j)}{k}
q_y^k
(1 - q_y)^{\min(i,j) - k}
$$

$$
p_k(x,z)=
\sum_{i = k}^{C_{x,y}}
\sum_{j = k}^{C_{y,z}}
p_i(x,y)\, p_j(y,z)\,
\binom{\min(i,j)}{k}
q_y^k
(1 - q_y)^{\min(i,j) - k}
$$

---

If $(x,y)$ and $(y,z)$ are physical links with:

- Capacity $C_{x,y}$, $C_{y,z}$
- Link success probabilities $q_{x,y}$, $q_{y,z}$

then the elementary link distributions are binomial:

$$
p_i(x,y) =
\binom{C_{x,y}}{i}
q_{x,y}^i
(1 - q_{x,y})^{C_{x,y} - i}
$$

$$
p_j(y,z) =
\binom{C_{y,z}}{j}
q_{y,z}^j
(1 - q_{y,z})^{C_{y,z} - j}
$$

