I've been looking for solution but got stuck.
I need to find shortest path in undirected graph. As input I got set of undirected edges (x,y,p) where x and y are nodes and p which is weight of the edge between x and y.
The length of a path is defined as the sum of of absolute differences between adjacent edges of each node.
Example edges:
1 2 1
1 3 5
2 4 5
3 4 5
4 6 2
There are multiple paths from 1 to 6:
1 -> 2 -> 4 -> 6 weight = |5 - 1| + |2 - 5| = 7
1 -> 3 -> 4 -> 6 weight = |5 - 5| + |2 - 5| = 3
Thus the shortest path has length 3, which should be the output of the algorithm.