0

Given an undirected graph G = {E,V}, with positive edge costs. For all node combinations, is there a way do determine if a certain node v is not on any of the shortest paths that its not an endpoint?

My thought is that it could be done by performing a modified form of Dijkstra's Algorithm on each node except for v, where it would mark if a v was in the solution. But I'm not sure how to modify the algorithm to do this.

Dez
  • 21
  • 6
  • Between two specific nodes a an b, there might be multiple shortest paths, do you want at least 1 of these paths not have v in them? or all of them must not have v? – DPDP Dec 09 '17 at 09:20
  • All of them must not have v – Dez Dec 09 '17 at 22:59

1 Answers1

1

Suppose v is the vertex and a and b are the starting and ending points relatively.

  1. find shortest path length from a to b.
  2. find shortest path length from a to v and v to b.
  3. If sum of step 2 is equal to value of step 1, v is on a potential shortest path from a to b.

PS: The algorithm time complexity remains same as finding shortest path.

Update: Dijkstra starts from one node and propagate minimum distances from that to other nods. It do this until it reaches all nodes(while Q is not empty). If you are interested one specific node(end point) you can do this process in Dijkstra until you reach that point(i.e suppose t is target point, you do (minimum)distance propagation until u extracted from Q. On the other hand at this line u ← vertex in Q with min dist[u] such that u equals t you can return dist[u]). Look at this for more detailed explanation about Dijkstra and good graphical illustrations.

Bonje Fir
  • 787
  • 8
  • 25
  • Is there a way to do this with Dijkstra's or does it require a different shortest path algorithm? Since according to what I've read Dijkstras only lets you specify a start node and you cant specify an end node. – Dez Dec 09 '17 at 23:07