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
Cythonize Yen_k_shortest_simple_paths and feng_k_shortest_simple_paths #28335
Comments
Author: Rajat Mittal |
Commit: |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
comment:3
I have cythonized the Yen and Feng's methods here as can be seen from the last commit in the list of above commits. In short I have used cython variables and cython data structures where ever possible in these methods. Also I have named the cython methods as yen_k_shortest_simple_paths_cython and feng_k_shortest_simple_paths_cython to separate them from yen_k_shortest_simple_paths and feng_k_shortest_simple_paths for consistency and speed checks. |
comment:4
The way you declare the priority queue is incorrect. This will fail if edge weights are not integers. The list |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:6
Replying to @dcoudert:
I agree with both the statements and made the changes appropriately |
comment:7
Seems correct. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:9
|
comment:10
After thinking about the utility of the hash_path not in idx_to_path.values() test , it seems like we don't really require it as per our algorithm as we are working on graphs without multiedges hence the path will no be repeated into the heap. So this test is unnecessary here. Also the test supporting it is shown in the above comment. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:13
I'm not fully convinced by the removal of this test. It is part of the algorithm for a reason. Consider an unweighted graph with many paths from u to v with same cost. For instance a complete graph. A same path might certainly been found several times, no ? |
comment:14
Replying to @dcoudert:
Actual algorithm never specify to do this test. I added this test thinking that a path may be repeated in the heap, but the way Yen's algorithm unfolds its not possible to add the same path twice.
|
comment:15
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:18
I did some changes in Yen. I think it is cleaner this way. I have not touched Feng. You can certainly try to follow what I did to start improving it. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:20
Following are the comparisons results between:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:22
Now that #27859 has been merged, it's much easier to check the code ;) Instead of creating new methods, I propose to replace the code of the previous Yen's method by the code of the Cython version, and to do the same for Feng. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:24
LGTM. We have a better code for Yen, and I propose to postpone to another ticket possible improvements for Feng (it should be much faster, but it's not). |
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
|
comment:26
I think it was necessary to rebase this tkt on 8.9beta7 otherwise some merge conflict might happen. |
comment:27
It was not necessary ! Firstly, I tested the ticket over beta 7, and secondly this does not prevent possible conflicts with other tickets (depends on the order in which the tickets are merged for next release). |
Changed branch from public/graphs/28335_Cythonize_Yen_Feng to |
This ticket aims to implement these methods in Cython for speed up and performance gains.
Depends on #27859
CC: @dcoudert
Component: graph theory
Keywords: gsoc2019
Author: Rajat Mittal
Branch/Commit:
aac00c3
Reviewer: David Coudert
Issue created by migration from https://trac.sagemath.org/ticket/28335
The text was updated successfully, but these errors were encountered: