I was wondering if I can modify Dijkstra’a Alghorithm in this way:
Let’s say there are 2 paths between two vertices with following lengths:
5, 8, 6, 9 // sum=28
2, 4, 8, 25 //sum=39
First path is shorter but after ignoring the longest edge in both I get the following sums: 19 and 14, so I choose the second path.
Maybe there is different way to solve it, without using Dijkstra?
I’m not sure is this idea working, but on first it seems to me like it can.
For each visited node, beside distance
D(n), store length of longest edge on the path to it, sayL(v). Distance of unvisited neighbouring node ismin D(n) + L(n) - max(L(n), weight(v,n)), for all neighboursnthat are visited.L(v)of next visited node ismax(L(n), weight(v,n)), ifnis last node on a path to thev. If there are more paths tov(moren's) with same length, than choose one with largestL(v).