Issue #41 - Remove non-gp_ and -g6_ function wrapper methods from Graph and G6(Read|Write)Iterator Cython classes#42
Merged
Conversation
…aph, since it's assumed that the caller has the Graph containing the graphP used to initialize the (read|writ)er.
Removed
* `Graph.get_wrapper_for_graphP()` (since we should never have to get a new `Graph` wrapper for the `graphP` contained by the `self`)
* `G6ReadIterator.duplicate_currGraph()` (since the owner of the `G6ReadIterator` should also own the `Graph` used to initialize the reader, they can directly call `curr_graph.gp_DupGraph()` to get a new `Graph` that wraps an independent `graphP`)
* `G6ReadIterator.get_currGraph()` (since the owner of the `G6ReadIterator` should also own the `Graph` used to initialize the reader, there shouldn't be a need to get another wrapper of that same `graphP`)
* `G6WriteIterator.reinitialize_currGraph()`, (since the owner of the `G6WriteIterator` will have access to the `Graph`, they should be able to directly run `curr_graph.gp_ReinitializeGraph()`)
* `G6WriteIterator.update_graph_to_write()` (since the owner of the `G6WriteIterator` will have access to the `Graph`, they should be able to directly run `curr_graph.gp_CopyGraph(src_graph=next_graph)`)
john-boyer-phd
approved these changes
Apr 24, 2026
Member
john-boyer-phd
left a comment
There was a problem hiding this comment.
This is great, nice and clean for the full API with no extra methods for Python-only developers! I also like that the "owns graph" business went away because now Graph always owns the underlying C graph object, which is correct.
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.
Resolves #41
Type of change
Please check only relevant options:
Changes
Added
Updated
planarity/full/graph.pxd- removedowns_graphPattribute fromGraphclass definitionplanarity/full/graph.pyx-self.owns_graphPfrom__init__()and no longer condition__dealloc__()on; theGraphalways owns thegraphPit contains.Graph.get_wrapper_for_graphP()(since we should never have to get a newGraphwrapper for thegraphPcontained by theself)planarity/full/g6IterationUtils.pyx-G6(Read|Write)IteratorCython classes no longer keep track of_currGraph, since it's assumed that the caller has the Graph containing the graphP used to initialize the (read|writ)er (i.e. call tocg6IterationDefs.g6_New(Read|Writ)er()in__cinit__()passes_theGraphof the input graph as an argument.)G6ReadIterator.duplicate_currGraph()(since the owner of theG6ReadIteratorshould also own theGraphused to initialize the reader, they can directly callcurr_graph.gp_DupGraph()to get a newGraphthat wraps an independentgraphP)G6ReadIterator.get_currGraph()(since the owner of theG6ReadIteratorshould also own theGraphused to initialize the reader, there shouldn't be a need to get another wrapper of that samegraphP)G6WriteIterator.reinitialize_currGraph(), (since the owner of theG6WriteIteratorwill have access to theGraph, they should be able to directly runcurr_graph.gp_ReinitializeGraph())G6WriteIterator.update_graph_to_write()(since the owner of theG6WriteIteratorwill have access to theGraph, they should be able to directly runcurr_graph.gp_CopyGraph(src_graph=next_graph))Removed
Testing
Coming soon
Replace with high-level description of log snippets
Details