Skip to content

Add a few more BFS-based algorithms#51

Merged
eriknw merged 7 commits intopython-graphblas:mainfrom
eriknw:more_bfs
Apr 15, 2023
Merged

Add a few more BFS-based algorithms#51
eriknw merged 7 commits intopython-graphblas:mainfrom
eriknw:more_bfs

Conversation

@eriknw
Copy link
Copy Markdown
Member

@eriknw eriknw commented Mar 5, 2023

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.T or AT in 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_connected and other algorithms.

Also, there may be a couple NetworkX bugs to fix or behaviors to match.

Implemented:

  • 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

- 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`
@eriknw
Copy link
Copy Markdown
Member Author

eriknw commented Mar 6, 2023

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-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 15, 2023

Codecov Report

❌ Patch coverage is 87.71429% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.62%. Comparing base (6de1fd6) to head (029a639).
⚠️ Report is 24 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eriknw
Copy link
Copy Markdown
Member Author

eriknw commented Apr 15, 2023

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.

@eriknw eriknw merged commit 09776b6 into python-graphblas:main Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants