Add IGraphAlg dispatch for connectivity algorithms#36
Open
nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
Open
Add IGraphAlg dispatch for connectivity algorithms#36nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
Conversation
New IGraphAlg methods that dispatch to the igraph C library:
- connected_components: returns component membership as Vector{Vector{Int}}
matching the Graphs.jl return format
- is_connected: checks weak connectivity via igraph_is_connected
- articulation: finds articulation points via igraph_articulation_points,
returns sorted 1-based vertex IDs
- bridges: finds bridges via igraph_bridges, converts edge IDs to
SimpleEdge pairs
All new methods accept any AbstractGraph and convert to IGraph internally,
matching the pattern of the existing diameter/radius/has_isomorph dispatch.
Tests verify output matches Graphs.jl for path, cycle, and disconnected
graphs. All 281 tests pass.
7 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #36 +/- ##
=========================================
+ Coverage 5.29% 5.95% +0.66%
=========================================
Files 8 8
Lines 4310 4330 +20
=========================================
+ Hits 228 258 +30
+ Misses 4082 4072 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
Added CHANGELOG.md entry in the latest push. Note: several CI checks fail on this PR but they are all pre-existing issues unrelated to this PR's changes:
All actual test jobs pass on all platforms and on Julia 1.10. |
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.
Summary
Adds
IGraphAlgdispatch methods for four commonly-used graph algorithms, allowing users to leverage the igraph C library's implementations via the same API pattern as the existingdiameter/radius/has_isomorphdispatches.New dispatches
connected_components(g, IGraphAlg())igraph_connected_componentsVector{Vector{Int}}is_connected(g, IGraphAlg())igraph_is_connectedBoolarticulation(g, IGraphAlg())igraph_articulation_pointsVector{Int}bridges(g, IGraphAlg())igraph_bridgesVector{SimpleEdge}All methods accept any
AbstractGraphand convert toIGraphinternally. Return types match the Graphs.jl conventions.Tests
Each new dispatch is tested against the Graphs.jl reference implementation on path graphs, cycle graphs, and disconnected graphs. All 281 tests pass.
Motivation
This addresses part of JuliaGraphs/Graphs.jl#446: "Dispatch from operations defined in Graphs to igraph implementation."