---
title: 'Min-2-DSP: Two Disjoint Shortest Paths'
url: https://www.emergentmind.com/topics/minimum-2-disjoint-shortest-paths-min-2-dsp
type: topic
---

# Min-2-DSP: Two Disjoint Shortest Paths

Searching arXiv for relevant papers on Min-2-DSP and closely related 2-DSP variants.
Minimum 2-Disjoint Shortest Paths (Min-2-DSP) denotes a small family of closely related graph problems centered on two terminal pairs and shortest-path structure. In one common optimization form, the input is an undirected graph \(G=(V,E)\) with nonnegative integer edge-weights \(w:E\to\mathbb{N}\) and two disjoint ordered terminal pairs \((s_1,t_1)\) and \((s_2,t_2)\); the task is to find vertex-disjoint paths \(P_1\) from \(s_1\to t_1\) and \(P_2\) from \(s_2\to t_2\) minimizing \(w(P_1)+w(P_2)\) [1603.08073]. In a second, equally common formulation, often written 2-DSP, each \(P_i\) must itself be a shortest \(s_i\)-\(t_i\) path, and the algorithmic task is to decide, count, or construct a disjoint pair [1809.03820]. More recent work also uses the name Min-2-DSP for minimizing \(\lvert V(P_1)\cap V(P_2)\rvert\) over shortest-path choices \(P_1\in\Pi(s_1,t_1)\), \(P_2\in\Pi(s_2,t_2)\) [2509.14588]. The literature therefore combines algebraic reductions to matchings and cycle covers, dynamic programming on shortest-path substructures, planar Pfaffian techniques, geometric decompositions, and highly parallel modulo-\(2^k\) computation.

## 1. Formulations and complexity landscape

The three main formulations differ in objective and in the role of shortestness. The total-length optimization form minimizes the sum of two disjoint path lengths for prescribed terminal pairs. The feasibility form requires each path to be individually shortest for its own pair and asks whether such a disjoint pair exists. The minimum-intersection form fixes shortestness first and minimizes the number of shared vertices.

| Formulation | Core requirement | Representative results |
|---|---|---|
| Total-length optimization | Minimize \(w(P_1)+w(P_2)\) over disjoint \(P_1,P_2\) | Randomized polynomial time in undirected graphs [1603.08073] |
| 2-DSP feasibility | Each \(P_i\) is a shortest \(s_i\)-\(t_i\) path and \(P_1,P_2\) are disjoint | Polynomial time for \(k=2\), then for any fixed \(k\) in undirected graphs [1809.03820], [1912.10486] |
| Minimum intersection of shortest paths | Minimize \(\lvert V(P_1)\cap V(P_2)\rvert\) over shortest-path choices | \(O(m^2n^3)\) in directed graphs with positive edge weights; \(O(m+n)\) in DAGs and undirected graphs [2509.14588] |

For the feasibility formulation, the \(k\)-Disjoint Shortest Paths problem is NP-complete if \(k\) is part of the input, while the case \(k=2\) is polynomially solvable on undirected graphs with strictly positive lengths and remains polynomial when zero edge lengths are allowed [1809.03820]. Lochet later showed that for any fixed \(k\), the undirected disjoint shortest paths problem admits a polynomial-time algorithm, and for any fixed \(C\) the algorithm extends to the case where each path connecting \((s,t)\) has length at most \(d(s,t)+C\) [1912.10486]. By contrast, directed generalizations are substantially harder: directed graphs with zero lengths already yield NP-hardness for \(k\ge 2\), and in the total-length optimization setting the problem is NP-hard in directed graphs even for two pairs [1809.03820], [2106.00714].

This multiplicity of definitions is a recurrent source of confusion. In some papers, “shortest two disjoint paths” means minimizing total length of a disjoint pair; in others it means disjointness among individually shortest paths; and in recent directed work “Min-2-DSP” may denote minimum intersection among shortest paths [1603.08073], [2509.14588]. The distinction matters because the available techniques, tractability frontiers, and output guarantees differ sharply across the three settings.

## 2. Algebraic optimization via permanents, hafnians, and isolation

A central line of work treats the total-length optimization problem by encoding disjoint path packings as matchings. Björklund and Husfeldt gave the first randomized polynomial-time algorithm for Min-2-DSP by reducing the problem to computing a permanent modulo \(4\) and applying the Mulmuley–Vazirani–Vazirani Isolation Lemma. The framework uses Gallai’s reduction to transform two vertex-disjoint \((s_1,t_1)\)- and \((s_2,t_2)\)-paths into a perfect matching in an auxiliary graph \(H\) of size \(O(|V|)\), assigns formal edge-weights \(x^{w(e)}\), and reads the minimum total weight from the lowest-degree surviving monomial after random perturbation makes the optimum unique with probability at least \(1/2\) [1603.08073].

Hirai and Namba generalized this framework from two terminal pairs to the shortest perfect \((A+B)\)-path packing problem. Their key replacement is hafnian computation modulo powers of two. For a symmetric \(2n\times 2n\) matrix \(M\), the hafnian is
\[
\operatorname{haf}(M)=\sum_{\pi\in \mathrm{PMP}(2n)}\prod_{i=1}^{n}M_{\pi(2i-1),\,\pi(2i)},
\]
so in the \(0\)-\(1\) adjacency case it counts perfect matchings. Using Gallai’s reduction, they build a symmetric matrix \(S\) with entries \(x^{w_H(i,j)}\) on auxiliary edges, obtaining
\[
\operatorname{haf}(S)=\sum_{M\ \mathrm{perfect}}x^{w(M)},
\]
which enumerates disjoint \(T\)-path packings. Their theorem states that for fixed \(k\), hafnians modulo \(2^k\) of polynomial-entry symmetric matrices can be computed in polynomial time, with a recursion that lifts \(\bmod\,2\) computation—where the hafnian equals the Pfaffian—to higher powers of two [1603.08073].

For Min-2-DSP, this yields a randomized polynomial-time algorithm with \(k=(|T|/2)+1=3\). One builds the Gallai graph \(H\), perturbs each original edge weight by a random offset \(\delta(e)\in\{m\cdot n,\dots,m\cdot n+2m-1\}\), forms the symmetric matrix \(S\), computes \(\operatorname{haf}(S)\bmod 2^k\), extracts the smallest exponent \(d^*\) with nonzero coefficient, and then recovers the actual optimal paths by deleting edges one by one and recomputing the minimum degree. The running time remains polynomial because \(k=3\) is constant. The same method extends to shortest perfect \((A+B)\)-path packing when \(|A|+|B|=2T\) is constant, with running time \(\mathrm{poly}(n)\cdot 2^{O(T)}\), but ceases to be polynomial when \(T\) grows with \(n\); indeed, the general \((A+B)\)-path packing problem is NP-hard when \(|A|+|B|\) is unbounded [1603.08073].

The significance of this line is twofold. First, it established that the total-length two-pair problem in undirected graphs is not only reducible to matching structure, but reducible in a way compatible with low-modulus algebra. Second, it exposed a precise limitation: the approach is effective when the number of terminal endpoints participating in the path-packing pattern is fixed, but not when that parameter scales.

## 3. Dynamic programming and structural algorithms for disjoint shortestness

For the feasibility version in undirected graphs with nonnegative lengths, Gottschau and coauthors developed a polynomial-time dynamic program that explicitly accommodates zero-length edges. The algorithm computes distance labels \(d_i(v)\), defines shortest-path networks
\[
E_i=\{\{u,v\}\in E\mid \ell(\{u,v\})=\lvert d_i(u)-d_i(v)\rvert\},
\]
orients each \(\{u,v\}\in E_i\) from smaller to larger \(d_i\)-value, leaves zero-length edges undirected, and replaces edges that lie in both \(E_1\) and \(E_2\) with opposite preferred directions by a gadget of four vertices and three arcs. In the resulting mixed graph \(\widehat G=(W,E_0\cup A_1\cup A_2)\), the weakly connected components of \((W,E_0\cup (A_1\cap A_2))\) are processed in nondecreasing order of \(d_1-d_2\), while a binary relation \(R^{(j)}\subseteq W^2\) is updated by
\[
R^{(j)} = C_j \circ B_j \circ R^{(j-1)}.
\]
The total procedure is polynomial, with an implementation bound stated as \(O(n^8)\) or better for \(k=2\) [1809.03820].

Lochet’s later fixed-\(k\) algorithm introduced a different structural view. For \(k=2\), it begins by constructing a 2-shortest graph \(G'\) via two BFS layerings from \(s_1\) and \(s_2\), discarding edges that do not connect consecutive levels in at least one layering. Each remaining edge is of colour \(1\), colour \(2\), or both; orienting each colour class yields acyclic digraphs \(D_1\) and \(D_2\). The bi-coloured edges decompose into connected components with strong contiguity and conflict properties: if \(P\) is a colour-\(i\) path and \(C\) is a bi-coloured component, then \(P\cap C\) is a single contiguous subpath, and if two paths conflict on such a component then that component is the only place they can meet. The notion of a blind pair—neither path “sees” the other through an internal suffix intersection—permits a reduction to a product-state digraph. For \(k=2\), Lemma 12 gives partitions into at most \(9\) subpaths per original path, and the resulting state graph has size \(O(n^{18})\), yielding polynomial time [1912.10486].

A third viewpoint, due to the geometric-lens framework, specializes to the unit-length undirected case and improves the \(k=2\) running time to \(O(nm)\). Each vertex \(v\) is mapped to
\[
\operatorname{pos} v = \bigl(\operatorname{dist}(s_1,v),\,\operatorname{dist}(s_2,v)\bigr)\in\mathbb{N}^2.
\]
Shortest-path geometry is then studied through diamonds \(\diamond{x}{y}\), coloured monotonicity, and the continuous drawings \(\zeta(P)\) of shortest paths. Two paths are handled by a three-case split: disjoint drawings, a non-integer crossing, or an integer-coordinate crossing. In the crossing cases, a constant number of “marble” vertices—\(\alpha,\omega,\partial,\varpi,\delta\)—divide the paths into monotone pieces lying in disjoint diamonds, and each guessed configuration reduces to disjoint paths in a DAG. The total cost is \(O(nm)\) on unit-length graphs [2007.12502].

Taken together, these results show that the 2-DSP feasibility problem admits several radically different decompositions: mixed-graph component sweeps for nonnegative weights including zeros, shortest-layer product states for fixed \(k\), and coordinate geometry for unweighted graphs. The common theme is that shortestness severely constrains admissible path interactions, and those constraints can be turned into dynamic-programming state reductions.

## 4. Planar, Pfaffian, and fixed-parameter methods

Planarity enables a separate family of techniques based on perfect matching counting and topological structure. In cubic planar graphs with two terminal pairs, Björklund and Husfeldt showed that there are NC algorithms, uniform circuits of polynomial size and polylogarithmic depth, that compute the shortest two disjoint paths problem and also output the number of optimum solutions. The reduction replaces each nonterminal vertex by a triangle gadget, each terminal by a 3-star gadget, and for each even subset \(X\subseteq A\cup B\) forms a planar subgraph \(H(X)\). With an indeterminate \(s\), external edges receive weight \(s^{\ell(e)}\), internal gadget edges weight \(1\), and Kasteleyn orientations give skew-symmetric matrices \(D(X,s)\) satisfying
\[
\operatorname{pm}(H(X);s)=\lvert \det D(X,s)\rvert.
\]
An alternating-sum polynomial \(p(s)\) cancels all unwanted pairings, and when \(|A|=2\) its degree is \(4\), so interpolation needs only five evaluations [1806.07586].

A closely related determinant-based cancellation framework applies to planar graphs whose four terminals lie on a single face. There, three outerplanar pairings \(M_0,M_1,M_2\) are considered, and the signed combination
\[
F(x)=P_{M_0}(x)-P_{M_1}(x)-P_{M_2}(x)
\]
cancels all monomials not corresponding to the designated pairing \(M_0=\{(s_1,t_1),(s_2,t_2)\}\). This yields a randomized or deterministic sequential algorithm of \(O(n^\omega)\) time for the decision problem, \(O(n^\omega\log n)\) for counting, and NC\(^2\) algorithms for decision and counting; the search version lies in RNC\(^2\) after isolation is used to force uniqueness [1802.01338].

Recent planar parameterized work replaces determinant cancellation by topological enumeration. For planar disjoint shortest paths with positive edge weights, the input graph is embedded in the plane, all terminals lie on the outer face, and the algorithm constructs a geodesic Steiner tree spanning the terminals, computes an exhaustive set of maximal DAG-rings around that tree, proves \(O(1)\) bounds on non-trivial crossings when \(k=2\), and enumerates only \(2^{O(k\log k)}\) homology classes before reducing each case to Schrijver’s polynomial-time Homology Feasibility problem. The general running time is \(2^{O(k\log k)}\cdot n^{O(1)}\), so substituting \(k=2\) yields polynomial time [2505.03353].

These planar results are not merely faster implementations of general methods. They rely on structure unavailable outside planar embeddings: Kasteleyn orientations, Pfaffian counting, dual cycles bounding rings, and homology classes of linkages. They also illustrate that terminal placement assumptions are consequential. Some algorithms require cubic planarity, others one-face placement, and the fixed-parameter result assumes all terminals on the outer face [1806.07586], [1802.01338], [2505.03353].

## 5. Parallelism, linear-time detection, and directed-graph advances

Parallel complexity entered the subject through modulo-\(2^k\) permanent computation. A 2021 result showed that for fixed \(k\), the permanent modulo \(2^k\) of a matrix of univariate integer polynomials lies in ParityL, hence in NC\(^2\). The paper reformulates shortest 2-disjoint paths as a special case of finding disjoint cycles through designated pattern edges. After adding dummy vertices \(u_1,u_2\), loops of weight \(1\), and opposite arcs labeled \(x^{w(e)}\), a small family of pattern graphs \(P_0,P_1,Q\) yields a polynomial
\[
f_2(x)\equiv \operatorname{perm}(A_{P_0}(x))+\operatorname{perm}(A_{P_1}(x))-\operatorname{perm}(A_Q(x)) \pmod 4
\]
whose lowest nonzero monomial identifies the optimum after random isolation. This places the general undirected problem into a highly parallel randomized setting, and with advice into ParityL/poly [2106.00714].

A different algebraic development produced optimal linear-time detection for the 2-DSP feasibility problem on weighted undirected graphs and DAGs. The key object is a polynomial
\[
F(x)=\sum_{S\ \mathrm{standard}} f(S),
\]
where \(S=\{P_1,P_2\}\) ranges over pairs of shortest-path candidates in the shortest-path DAGs and \(f(S)\) is the product of edge variables along both paths. Over a field of characteristic two, the polynomial is decomposed as \(F=F_{\mathrm{disj}}+F_{\cap}\), and a sequence of subpath-swapping involutions cancels all intersecting contributions in linear time. In DAGs, the cancellation is indexed by the first meeting vertex \(v\); in undirected graphs, intersecting pairs are partitioned into agreeing and disagreeing types. Random evaluation over \(\mathbb{F}_{2^q}\) then yields an \(O(n+m)\)-time algorithm for detection, but not for search. The paper states that one can obtain a search algorithm in \(O(n\cdot(n+m))\) time via Baur–Strassen and edge-peeling [2404.15916].

Directed graphs remained more difficult. A 2025 result gave an \(O(mn\log n)\)-time algorithm for 2-DSP in weighted directed graphs without negative or zero weight cycles, improving a previously known \(O(m^5n)\) bound. The same paper defines Min-2-DSP as minimizing the number of vertex intersections between a shortest \(s_1\)-\(t_1\) path and a shortest \(s_2\)-\(t_2\) path, and gives the first efficient algorithms for that objective: \(O(m^2n^3)\) time in directed graphs with positive edge weights and \(O(m+n)\) time in DAGs and undirected graphs, with \(O(mn^2\log n)\) reporting in the directed case and \(O(m+n)\) reporting in DAGs and undirected graphs once the optimum is known [2509.14588].

These results refine the algorithmic map in two directions. First, they show that parallelism is compatible with the older algebraic isolation-based methods. Second, they separate detection from construction: linear-time algebraic cancellation currently decides 2-DSP in undirected graphs and DAGs, but does not by itself yield equally fast path output [2106.00714], [2404.15916].

## 6. Related variants, boundary cases, and persistent limitations

Several nearby problems illuminate what is special about Min-2-DSP. The classical directed single-source, single-target version with two edge-disjoint paths of minimum total cost is solved by the Suurballe–Tarjan method in \(O(m+n\log n)\) time: one shortest-path tree is reweighted by reduced costs, residual tree edges are reversed at zero cost, a second Dijkstra run finds an augmenting walk, and cancellation of antiparallel pairs yields two minimum-cost disjoint paths. The same construction gives a single-source 2-multipath preserver with exactly \(2(n-1)\) edges [2106.12293]. This problem is often used as a baseline, but it differs substantially from the two-pair disjoint shortest-path formulations.

Weights are another sharp boundary. In the undirected 2-DSP feasibility problem, zero edge lengths can be handled polynomially by the mixed-graph dynamic program described above, but in directed graphs zero lengths lead to NP-hardness for \(k\ge 2\) [1809.03820]. For a same-terminal-pair total-weight problem with conservative weights, negative edges already cause NP-hardness in general, yet if the negative-weight edges form only a constant number \(c\) of trees, an \(n^{O(c)}\)-time algorithm exists. That algorithm combines minimum-cost flow for separable solutions, recursion on the number of negative trees, and dynamic programming on a single negative tree [2307.12602].

Parameter dependence remains delicate. The fixed-\(k\) undirected polynomial algorithm for disjoint shortest paths shows that constant \(k\) is tractable in full generality [1912.10486], but the geometric-lens paper also proves that \(k\)-DSP is W[1]-hard with respect to \(k\) [2007.12502]. Planarity changes that picture: planar disjoint shortest paths with positive edge weights becomes fixed-parameter tractable with running time \(2^{O(k\log k)}\cdot n^{O(1)}\) [2505.03353]. On the algebraic optimization side, the hafnian framework for shortest perfect \((A+B)\)-path packing is polynomial only when \(|A|+|B|\) is fixed; when the terminal set is unbounded, the problem is NP-hard [1603.08073].

A final recurrent distinction is between edge-disjointness and vertex-disjointness. Some papers work directly with edge-disjoint shortest paths, others with vertex-disjoint paths, and several note that a minor variant handles vertex-disjointness by splitting vertices in advance, or that edge-disjoint variants are completely analogous [1809.03820], [2106.00714]. This does not make the two notions interchangeable, but it explains why techniques developed for one model often migrate quickly to the other.

Across these variants, the subject has developed from isolated polynomial-time results for \(k=2\) into a landscape with exact algebraic counting, component-wise dynamic programming, planar NC computation, fixed-parameter topological methods, and linear-time randomized detection. The enduring difficulties are equally clear: directed graphs remain harder than undirected ones, search is harder than detection, and the notational label “Min-2-DSP” itself has not stabilized across the literature.

Source: https://www.emergentmind.com/topics/minimum-2-disjoint-shortest-paths-min-2-dsp