- Notifications
You must be signed in to change notification settings - Fork5
Addfloyd_warshall#42
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
SultanOrazbayev commentedJan 31, 2023
A potential optimization is to loop over n, where n is rows with non-zero values. |
codecov-commenter commentedJan 31, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportBase:72.91% // Head:72.25% // Decreases project coverage by
📣 This organization is not using Codecov’sGitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories.Learn more Additional details and impacted files@@ Coverage Diff @@## main #42 +/- ##==========================================- Coverage 72.91% 72.25% -0.66%========================================== Files 70 72 +2 Lines 2573 2617 +44 Branches 475 479 +4 ==========================================+ Hits 1876 1891 +15- Misses 528 557 +29 Partials 169 169
Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here. ☔ View full report at Codecov. |
eriknw commentedJan 31, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Good suggestion. I added an optimization where we only iterate over vertices that have nonempty rowsand nonempty columns. Ithink this behaves correctly, but would appreciate if somebody could verify it. I also introduced another temporary matrix to hold the outer product. We then drop the diagonal values from them. All this performs better or similar in my limited benchmarking. Our strategy of keeping things sparse isprobably reasonable, because what if there are multiple groups of connected components? The final result frequently may not be dense. With the goal of "keeping things sparse", I wonder if there are any heuristics we could employ, such as iterating over vertices with small degrees first. |
| A, row_degrees, column_degrees = G.get_properties("offdiag row_degrees- column_degrees-") | ||
| nonempty_nodes = binary.pair(row_degrees & column_degrees).new(name="nonempty_nodes") | ||
| else: | ||
| A, nonempty_nodes = G.get_properties("offdiag degrees-") |
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.
Note that we use some shorthand notation here."degrees-"does not include self-edges (i.e., diagonals), but"degrees+"does include self-edges.
| Row = Matrix(dtype, nrows=1, ncols=n, name="Row") | ||
| Col = Matrix(dtype, nrows=n, ncols=1, name="Col") | ||
| Outer = Matrix(dtype, nrows=n, ncols=n, name="temp") | ||
| for i in nonempty_nodes: |
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.
Looks good!
SultanOrazbayev commentedFeb 1, 2023
Not sure about this, it could lead to gotchas if users don't expect sorting to happen. (and sorting itself could be an issue, e.g. when using distributed graphs) |
Uh oh!
There was an error while loading.Please reload this page.
CC@jim22k@SultanOrazbayev @LuisFelipeRamos
I made a few minor modifications to the algorithms from what we wrote together today. I'm happy to answer any questions. I tinkered around a little to make things faster.
We can probably get this to work with
dask-graphblastoo, which I think would be pretty interesting, because it can create a massive, distributed matrix. It may not be thebest way to compute APSP, buta way is better than no way at all :)See the original LAGraph version of Floyd-Warshall here:
https://github.com/GraphBLAS/LAGraph/blob/ed55a49ee7138d2b5a6c5eb4329ccd0bf9e4ac17/old/experimental_algorithm/LAGraph_FW.c
I'll try to benchmark and compare this with a NumPy implementation on a beefy machine with lots of memory.