Complete Graphs.jl AbstractGraph API for IGraph#35
Open
nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
Open
Complete Graphs.jl AbstractGraph API for IGraph#35nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
nenadilic84 wants to merge 2 commits intoJuliaGraphs:masterfrom
Conversation
Implement the missing Graphs.jl interface methods so that IGraph can be used with all existing Graphs.jl algorithms: - edges: lazy IGraphEdgeIterator over igraph edge IDs - outneighbors/inneighbors: via LibIGraph.neighbors with 0→1 index shift - add_edge!: with duplicate and self-loop guards - add_vertex!: via raw igraph_add_vertices ccall - rem_vertex!: via igraph_delete_vertices with igraph_vss_1 selector - copy: via LibIGraph.copy into uninitialized IGraph Also fix has_edge to correctly convert 1-based Julia indices to 0-based igraph indices before calling get_eid. Add GraphsInterfaceChecker.jl to test dependencies and a comprehensive test suite that validates both the mandatory and optional (mutation) parts of the AbstractGraph interface. All 305 tests pass (up from 267).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #35 +/- ##
=========================================
+ Coverage 5.29% 6.37% +1.08%
=========================================
Files 8 8
Lines 4310 4342 +32
=========================================
+ Hits 228 277 +49
+ Misses 4082 4065 -17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7 tasks
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 (ubuntu, macOS x64/aarch64, windows) and on Julia 1.10. |
Author
|
/claim #446 |
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
This PR completes the
Graphs.jlAbstractGraphinterface for theIGraphtype, enablingIGraphto be used with all existing Graphs.jl algorithms that operate through the API.Changes
New interface methods:
Graphs.edges— lazyIGraphEdgeIteratorover igraph edge IDs (0→1 index conversion)Graphs.outneighbors/Graphs.inneighbors— viaLibIGraph.neighborswith sorted outputGraphs.add_edge!(g, s, d)— with duplicate-edge and self-loop guardsGraphs.add_vertex!— via rawigraph_add_verticesccallGraphs.rem_vertex!— viaigraph_delete_verticeswithigraph_vss_1selectorBase.copy— viaLibIGraph.copyinto uninitializedIGraphBug fix:
Graphs.has_edgenow correctly converts 1-based Julia indices to 0-based igraph indices before callingget_eidTests:
GraphsInterfaceChecker.jlas a test dependencyAbstractGraphinterfaceMotivation
This addresses part of #446: "Complete Graph API support for the IGraph types (so that IGraph types can be used in all already existing Graph.jl algorithms that do not peek behind the API)" and "use GraphsInterfaceChecker.jl in the test suite".