question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeltaSteppingShortestPath unable to solve SSSP on a path with 3+ edges

See original GitHub issue
 * JGraphT version: 1.5.0 [also tested on 1.4.0]
 * Java version (java -version)/platform:  adopt-openjdk-15/windows [also tested on oracle 1.8.0_265/windows]

Issue DeltaSteppingShortestPath cannot solve the Shortest Path Problem on a Graph where the target vertex is 3 or more edges away from the source vertex.

Steps to reproduce (small coding example)

DirectedWeightedMultigraph<String, DefaultWeightedEdge> graph = new DirectedWeightedMultigraph<>(DefaultWeightedEdge.class);
graph.addVertex("v0");
graph.addVertex("v1");
graph.addVertex("v2");
graph.addVertex("v3");
graph.addEdge("v0", "v1");
graph.addEdge("v1", "v2");
graph.addEdge("v2", "v3");
new DeltaSteppingShortestPath<>(graph).getPath("v0", "v3") // this returns null
new DijkstraShortestPath<>(graph).getPath("v0", "v3") // this returns a non-null result

Expected behaviour DeltaSteppingShortestPath should find a similar solution to DijkstraShortestPath

Other information

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
SChudakovcommented, Jan 17, 2021

I`ve fixed the bug in my local branch. I will submit a PR after #972 gets merged since I made my changes on top of those commits.

Basically, the problem goes as follows: the computation of the number of buckets is correct. However, the iteration over the bucket structure during shortest path computation is incorrect because every bucket is traversed only once. For it to be correct, the number of buckets should be equal to ceil(L/delta) where L is the maximum weight of the shortest path in the graph.

In our implementation, we have the number of buckets computed as

numOfBuckets = (int) (Math.ceil(maxEdgeWeight / delta) + 1);

and vertices are getting assigned to buckets as

private int bucketIndex(double distance) {
    return (int) Math.round(distance / delta) % numOfBuckets;
}

therefore some buckets might be traversed multiple times. To fix this issue it is needed to start with the first non-empty bucket in every interaction, as shown here:

Screenshot from 2021-01-17 12-57-23

0reactions
SChudakovcommented, Apr 29, 2021

I guess we can close this now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(PDF) Delta-stepping: a parallelizable shortest path algorithm
Abstract and Figures. The single source shortest path problem for arbitrary directed graphs with n nodes, m edges and nonnegative edge weights ...
Read more >
∆-stepping: a parallelizable shortest path algorithm
Our new algorithm, which we call Delta-stepping, can be implemented very efficiently in sequential and parallel setting for a large class of graphs....
Read more >
Delta-stepping SSSP: from Vertices and Edges to GraphBLAS ...
We illustrate our approach by translating the delta-stepping single source shortest path algorithm from its canonical description to a GraphBLAS implementation, ...
Read more >
bale/sssp.md at master · jdevinney/bale - GitHub
We are given the adjacency matrix for a graph with non-negative edge weights ... "Delta-stepping: a parallelizable shortest path algorithm" by U. Meyer...
Read more >
Parallel single-source shortest path algorithm - Wikipedia
One of the generalizations of the shortest path problem is known as the single-source-shortest-paths (SSSP) problem, which consists of finding the shortest ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found