Add a few more BFS-based algorithms#51
Merged
eriknw merged 7 commits intopython-graphblas:mainfrom Apr 15, 2023
Merged
Conversation
- Components - `is_connected` - `is_weakly_connected` - `node_connected_component` - Shortest Paths - `all_pairs_shortest_path_length` - `negative_edge_cycle` - `single_source_shortest_path_length` - `single_target_shortest_path_length` - Traversal - `bfs_layers` - `descendants_at_distance`
Member
Author
|
I'm also not sure if these are the best algorithms for connected component-related functions. Connected components are an important class of algorithms that we should add soon (for example, we have an implementation of FastSV in a Jupyter notebook that we can port over), so perhaps we'll revisit these algorithms then. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
+ Coverage 69.16% 71.62% +2.46%
==========================================
Files 77 89 +12
Lines 3152 3461 +309
Branches 602 642 +40
==========================================
+ Hits 2180 2479 +299
+ Misses 786 783 -3
- Partials 186 199 +13 🚀 New features to boost your workflow:
|
Member
Author
|
Merging so we can do a release before PyConUS. May be able to benchmark and shakedown some algorithms later, but they're probably good enough. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BFS is a workhorse! There are still many BFS-based algorithms still to do.
My main TODO is to benchmark these to give them a proper shakedown. I like to shake down most algorithms we add. Also, I wonder whether we should use
A.TorATin a couple places. I also wonder if we can come up with a heuristic to detect negative cycles.It may be nice to know whether directed graphs are structurally symmetric. If we knew this, we could improve
is_weakly_connectedand other algorithms.Also, there may be a couple NetworkX bugs to fix or behaviors to match.
Implemented:
is_connectedis_weakly_connectednode_connected_componentall_pairs_shortest_path_lengthnegative_edge_cyclesingle_source_shortest_path_lengthsingle_target_shortest_path_lengthbfs_layersdescendants_at_distance