-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shortest paths: prevent producing loops and remove some duplicated work #1747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
I'll run some tests on a real-world graph.
eclair-core/src/test/scala/fr/acinq/eclair/router/RouteCalculationSpec.scala
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/router/RouteCalculationSpec.scala
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/router/RouteCalculationSpec.scala
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1747 +/- ##
==========================================
- Coverage 86.67% 86.47% -0.20%
==========================================
Files 154 154
Lines 11996 12004 +8
Branches 516 528 +12
==========================================
- Hits 10397 10381 -16
- Misses 1599 1623 +24
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Several improvements to
yenKshortestPaths
:yenKshortestPaths
backwards like what is already done indijkstraShortestPath
. It allows to compute the correct weights directly.dijkstraShortestPath
several times on the same input by only computing spur paths for new edges.shortestPaths(k)
often has a lot of overlap with the previousshortestPaths
so a lot of the poential spur nodes were already considered.