Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
eriknw merged 4 commits intopython-graphblas:mainfromeriknw:floyd_warshall
Feb 2, 2023
Merged

Conversation

@eriknw
Copy link
Member

@eriknweriknw commentedJan 31, 2023
edited
Loading

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 withdask-graphblas too, 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.

SultanOrazbayev reacted with thumbs up emoji
@SultanOrazbayev
Copy link
Member

A potential optimization is to loop over n, where n is rows with non-zero values.

@codecov-commenter
Copy link

codecov-commenter commentedJan 31, 2023
edited
Loading

Codecov Report

Base:72.91% // Head:72.25% // Decreases project coverage by-0.66%⚠️

Coverage data is based on head(b02851b) compared to base(140bea8).
Patch coverage: 38.29% of modified lines in pull request are covered.

📣 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
Impacted FilesCoverage Δ
...blas_algorithms/algorithms/shortest_paths/dense.py16.12% <16.12%> (ø)
graphblas_algorithms/nxapi/shortest_paths/dense.py57.14% <57.14%> (ø)
...s_algorithms/algorithms/shortest_paths/__init__.py100.00% <100.00%> (ø)
graphblas_algorithms/interface.py97.46% <100.00%> (+0.13%)⬆️
...phblas_algorithms/nxapi/shortest_paths/__init__.py100.00% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment?Let us know in this issue.

@eriknw
Copy link
MemberAuthor

eriknw commentedJan 31, 2023
edited
Loading

A potential optimization is to loop over n, where n is rows with non-zero values.

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-")
Copy link
MemberAuthor

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.

SultanOrazbayev reacted with thumbs up emoji
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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good!

eriknw reacted with heart emoji
@SultanOrazbayev
Copy link
Member

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.

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)

eriknw reacted with thumbs up emoji

@eriknweriknw merged commit6dd93bd intopython-graphblas:mainFeb 2, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@SultanOrazbayevSultanOrazbayevSultanOrazbayev left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@eriknw@SultanOrazbayev@codecov-commenter

[8]ページ先頭

©2009-2025 Movatter.jp