Skip to content

Issue #41 - Remove non-gp_ and -g6_ function wrapper methods from Graph and G6(Read|Write)Iterator Cython classes#42

Merged
john-boyer-phd merged 1 commit into
masterfrom
Issue41-RemoveNonGraphLibMethods
Apr 24, 2026
Merged

Issue #41 - Remove non-gp_ and -g6_ function wrapper methods from Graph and G6(Read|Write)Iterator Cython classes#42
john-boyer-phd merged 1 commit into
masterfrom
Issue41-RemoveNonGraphLibMethods

Conversation

@wbkboyer
Copy link
Copy Markdown
Member

Resolves #41

Type of change

Please check only relevant options:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Changes

Added

  • N/A

Updated

  • planarity/full/graph.pxd - removed owns_graphP attribute from Graph class definition
  • planarity/full/graph.pyx -
    • Removed self.owns_graphP from __init__() and no longer condition __dealloc__() on; the Graph always owns the graphP it contains.
    • Removed Graph.get_wrapper_for_graphP() (since we should never have to get a new Graph wrapper for the graphP contained by the self)
  • planarity/full/g6IterationUtils.pyx -
    • G6(Read|Write)Iterator Cython 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 to cg6IterationDefs.g6_New(Read|Writ)er() in __cinit__() passes _theGraph of the input graph as an argument.)
    • Removed:
      • 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))

Removed

  • N/A

Testing

Coming soon

  • Outline manual or automated tests performed and how it relates to the particular feature added or functionality changed
  • Upload logs or provide relevant snippets of terminal output to demo functionality
Replace with high-level description of log snippets
Paste terminal log snippets here
Details

…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)`)
@wbkboyer wbkboyer requested a review from john-boyer-phd April 24, 2026 00:14
Copy link
Copy Markdown
Member

@john-boyer-phd john-boyer-phd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@john-boyer-phd john-boyer-phd merged commit 176af7a into master Apr 24, 2026
5 checks passed
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.

Remove non-gp_ and -g6_ function wrapper methods from Graph and G6(Read|Write)Iterator Cython classes

2 participants