Skip to content

Add IGraphAlg dispatch for connectivity algorithms#36

Open
nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
nenadilic84:feat/igraphalg-dispatch
Open

Add IGraphAlg dispatch for connectivity algorithms#36
nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
nenadilic84:feat/igraphalg-dispatch

Conversation

@nenadilic84
Copy link
Copy Markdown

Summary

Adds IGraphAlg dispatch methods for four commonly-used graph algorithms, allowing users to leverage the igraph C library's implementations via the same API pattern as the existing diameter/radius/has_isomorph dispatches.

New dispatches

Function igraph C function Return type
connected_components(g, IGraphAlg()) igraph_connected_components Vector{Vector{Int}}
is_connected(g, IGraphAlg()) igraph_is_connected Bool
articulation(g, IGraphAlg()) igraph_articulation_points Vector{Int}
bridges(g, IGraphAlg()) igraph_bridges Vector{SimpleEdge}

All methods accept any AbstractGraph and convert to IGraph internally. 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."

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.
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.95%. Comparing base (d37f19c) to head (e5bb5b3).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nenadilic84
Copy link
Copy Markdown
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:

  • Documentation: docs/make.jl does not exist in the repo yet
  • Spell Check: .typos.toml config file is missing from the repo
  • evaluate: SnoopCompile FieldError on Core.Binding (tooling compatibility issue)
  • performance-tracking: BenchmarkCI JSON parse error
  • Julia alpha: JET incompatible with Julia 1.13 beta

All actual test jobs pass on all platforms and on Julia 1.10.

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.

1 participant