Repository navigation
Implement the edges iterator - #35
Closed
singhharsh1708 wants to merge 2 commits into
Closed
singhharsh1708 wants to merge 2 commits into
singhharsh1708 wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #35 +/- ##
===========================================
+ Coverage 45.90% 68.18% +22.28%
===========================================
Files 1 1
Lines 61 88 +27
===========================================
+ Hits 28 60 +32
+ Misses 33 28 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
#14 carries an |
This was referenced Sep 7, 2026
singhharsh1708
force-pushed
the
feat/edges
branch
from
September 7, 2026 08:03
7acfe8d to
ad935f2
Compare
singhharsh1708
force-pushed
the
feat/edges
branch
from
September 7, 2026 09:11
ad935f2 to
7d5155e
Compare
Member
|
LLM work from new contributors is not acceptable for bounties |
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.
Fills in the last
Graphs.edgesTODO, so theAbstractGraphinterface onVNGraphis complete.edges(g)returns a lazy iterator yielding each edge once in lexicographic order, matchingedges(SimpleGraph(g))edge for edge.The inherited
SimpleEdgeItercannot be used: it reaches forfadj(g, u), which resolves tog.fadjlistand does not exist on aVNGraph, and it has noeltypemethod for anything butSimpleGraphandSimpleDiGraph. Definingfadjover the C array would be worse than an error, sincevery_nautystores adjacency unsorted andSimpleEdgeItercallssearchsortedfirston it, so it would silently return the wrong edge set.A self loop is stored twice in the vertex's own adjacency list while
nedgescounts it once. #34 collapses that repeat inoutneighbors, so the iterator yields it once andlength(edges(g)) == ne(g)stays exact.One pre-existing inconsistency, deliberately not touched here:
SimpleGraph(::VNGraph)converts with a stricti < jtest, so it drops self loops. On a graph with a self loop,ne(g)andedges(g)count it but the convertedSimpleGraphdoes not. Making those agree means deciding whether this wrapper admits self loops at all, which is your call rather than a side effect of this PR.Verified against the
SimpleGraphconversion on 20 random regular graphs, checking the full edge sequence, lexicographic order andlength == ne, plus element type, the empty and edgeless graphs, duplicate adds, the self loop andin: 908 passing. Reverting the iterator makes the test error on its firstcollect.Part of JuliaGraphs/Graphs.jl#448, stacked on #34; commit 7d5155e is the one belonging to this PR.
AI Disclosure: Claude assisted with the code. Testing and review by @singhharsh1708.