Input: Graph G (assume all edges have unit weights), source-destination vertex pairs (X1, Y1) , (X2 Y2) , …, (Xk, Yk) (all of them are distinct).
Output: Routes R1 (from X1 to Y1), R2(from X2 to Y2), … , Rk (from Xk to Yk) such that R1, R2, …, Rk do not share any vertices between them. No need to optimize the route length.
What algorithm to use? What would be the complexity of this problem? I need a theoretically strong solution, not a heuristics works-most-of-the-time solution.
The most obvious solution is to assign each free vertex(not in X1, X2, .. Xk, or Y1, Y2, …, Yk) to one of the k paths and see if they actually form paths in the required way. There are possible n^k assignments ( (n-2k)^k to be more precise). Can we do better? What if we assume the graph to be a 2d grid structure? (Equivalent to solving https://play.google.com/store/apps/details?id=com.bigduckgames.flow game, but without fill every square requirement).
You can find one of the possible solutions in this paper: “The disjoint paths problem in quadratic time” by Ken-ichi Kawarabayashi, Yusuke Kobayashi, Bruce Reed (pdf).
This solution is not trivial but efficient – only O(N2) time complexity, where N is the number of vertices. It is efficient only if K is a small constant.
It is also possible to solve this as Multi-commodity flow problem. But I doubt any multi-commodity-specific algorithm is efficient enough. Because general multi-commodity flow problem (when flow for at least one commodity is greater than one) is NP-hard.
It is unlikely that this is solvable as a single-commodity flow problem. For example, here is a counter-example to the following proposal:
It is easy to find a flow of capacity 1.5 (this flow is shown on diagram). But there is no way to connect both (green and red) pairs of vertices with disjoint paths.