1

I have implemented Suurballe's and Bhandari's algorithms into a project I am currently doing based on this:

http://www.macfreek.nl/memory/Disjoint_Path_Finding

And it seems to work really well. However, what I am doing now is having a start and end node, from which the disjoint paths are calculated.

The extension is, that I now wish to be able to use different start and end nodes for each path, or just one of them. If I just use the current algorithm it will indeed find two disjoint paths, however, if one of the end or start nodes are a part of the shortest route this will be included in the Suurballe algorithm for example - which it obviously shouldn't.

My question is: How do I do this extension? Do I just delete the start and end nodes in the Suurballe algorithm, or do I need to take something else into account?

Denver Dang
  • 171
  • 6
  • Can you give a self-contained statement of the problem you want to solve? I can't tell what problem you are trying to solve: apparently I need to infer it by guessing based on the algorithm names what the base problem is, then applying some modifications based on your "extension". That's a bunch of work for us to do before we can even think about your problem, and it risks us misunderstanding what problem you want solved. – D.W. Jun 04 '21 at 23:41

2 Answers2

1

Caveat

The procedure suggested here only works if you either have multiple start or multiple terminal nodes. As @D.W. has pointed out in the comments, if you have multiple end points of both kinds, the following idea does not ascertain that the right nodes be paired when constructing the paths.

Answer

If you have $k$ paths with pairwise different start or end nodes $\{s_i\} _{(i=1...k)}$ or $\{t_i\} _{(i=1...k)}$, resp. , add to the graph a synthetic start node $s$ or a synthetic end node $t$ and edges between the synthetic and the original start/end nodes: $\{(s, s_i)¦i=1...k\}$ or $\{(t_i, t)¦i=1...k\}$, each of the new edges having weight 0.

Then apply Suurballe's algorithm with pairs of start/end nodes $(s, t_0)$, or $(s_0, t)$, with $s_0$ or $t_0$, resp., being the end point shared between paths.

There are exactly $k$ incident edges to $s$ ($t$), so all original start / end nodes will be located on exactly one of the $k$ disjoint result paths.

If you have a start or end node where multiple paths (say $m(x_i)$ for node $x_i$) should start or end, clone that node and it's linkage with the rest of the graph $m(x_i)-1$ times, use the new nodes as additional start/end nodes and follow through with the above construction.

From your problem description, you want to compute node-disjoint paths. Then no complication arises from nodes subject to cloning which are adjacent in the original graph: in linking the set of clones you only need to consider the original nodes, as the edge between the original two nodes will not be part of any path in the (node-)disjoint solution.

collapsar
  • 932
  • 6
  • 12
  • Thank you for your answer. However, I am not entirely sure I understand the clone scenario. In my case I maximum have 2 node-disjoint paths. So a primary and a secondary path. That's all. So if I have a different start node and a different end node for both paths I then clone the first start and end node and all it's edges, or...? – Denver Dang Jun 07 '21 at 13:04
  • if you only have 2 node-disjoint paths, the Clone scenario does not apply. You just have to make sure that none of one path's terminal points lies on the other path. – collapsar Jun 09 '21 at 00:04
  • 1
    I don't believe your algorithm solves the problem you stated: your algorithm might output paths $s_1 \leadsto t_2$ and $s_2 \leadsto t_1$, which wouldn't meet your requirements. I am not sure whether that the problem you are solving is the one the original poster wants solved. This is one reason why I asked for clarification of the problem statement, but I haven't seen a response. I'm not sure whether the problem you are trying to solve is in P; see, e.g., https://cs.stackexchange.com/q/119037/755 and https://cs.stackexchange.com/q/43644/755. – D.W. Jun 09 '21 at 07:41
  • @D.W You are right. Caveat added to the answer. DenverDang: Is your problem correctly understood ? – collapsar Jun 09 '21 at 13:54
0

You already know the Suurballe algorithm that works for paths with same source and same destination vertices. So to solve your problem, you can just add a dummy vertex S to your graph and connect Start node of path1 and start node of path2 to S with edge weight 0. Add a dummy vertex E to your graph and connect End node of path1 and End node of path2 to S with edge weight 0. Now you can run suurballe algorithm to compute disjoint paths from S to E. After you get the paths, remove dummy vertices S and E. Now you have got your desired output.

SSShet
  • 1