Skip to content

Issue #46 - bump planarity/c/graphLib/ to match EAPS graphLib as of HEAD of master#49

Merged
john-boyer-phd merged 5 commits into
masterfrom
Issue46-EAPSGraphLibBumpFor500
May 20, 2026
Merged

Issue #46 - bump planarity/c/graphLib/ to match EAPS graphLib as of HEAD of master#49
john-boyer-phd merged 5 commits into
masterfrom
Issue46-EAPSGraphLibBumpFor500

Conversation

@wbkboyer
Copy link
Copy Markdown
Member

@wbkboyer wbkboyer commented May 16, 2026

Resolves #46

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

  • Updated C source files in planarity/c/graphLib/ to HEAD of EAPS master, which incorporate EAPS PR#214 and EAPS PR#214
  • MANIFEST.in - added recursive-include planarity/c/ *.h so that header files would be included in source distribution tarball (as per this recommendation on setuptools Issue #1162)
  • planarity/__init__.py - bumped version for subsequent testing to TestPyPI (will be updated to 1.0 when we do the release)
  • planarity/classic/cplanarity.pxd, planarity/full/cgraphLib.pxd - updated definition files to match new function and macro names in graphLib, and rearranged so that the headers are listed in alphabetical order and the declarations match the location in which they are declared in their respective headers.
  • planarity/classic/planarity.c, planarity/full/g6IterationUtils.c, planarity/full/graph.c - regenerated on MacOS Tahoe (26.3.1) using Python 3.14 with Cython==3.2.4 and setuptools==82.0.1
  • planarity/classic/planarity.pyx - since gp_FindExtension() technically expects a void **, I updated the definition in planarity/classic/cplanarity.pxd and changed the cast of the context in nodes() and edges(). Also used new names for gp_GetFirstVertex() (i.e. gp_LowerBoundVertices()) and gp_GetLastVertex() (i.e. gp_UpperBoundVertices()), and since these are meant for iteration bounds, it is now appropriate for the range() to not include the value returned (i.e. remove the +1 for value assigned to last). Finally, updated PGraph's __init__() so that it uses gp_DynamicAddEdge() when populating the graph, and updated all return value checks so that we error out when staus != cplanarity.OK (rather than == cplanarity.NOTOK)
    • NOTE: Need to review the assignment of self.embedding in embed_planar() method; if the result of gp_Embed() is NOTOK, this evaluates to 0 (rather than OK (1) or NONEMBEDDABLE (-1), which are both truthy), so someone might just try to gp_Embed() again if the graph is in an error state rather than having never had gp_Embed() run on it
  • planarity/full/g6IterationUtils.pyx - removed errant tab
  • planarity/full/graph.pyx - reorganized Graph methods so that they appear in the same order in which the functions/macros they wrap appear in the .pxd definition file, and use updated function + macro names

Removed

  • N/A

Testing

  • Outline manual or automated tests performed and how it relates to the particular feature added or functionality changed
    • Built source distribution using python -m build --sdist and published to TestPyPI using python -m twine upload --repository testpypi dist/planarity-0.7.13.tar.gz, then installed to clean test virtual environment using python -m pip install --index-url https://test.pypi.org/simple/ --no-deps --no-build-isolation planarity (after installing setuptools), then ran through examples/ scripts, ran pytest, and ran test_all_graphs.py in (currently private) EAPS-T repo
  • Upload logs or provide relevant snippets of terminal output to demo functionality
Replace with high-level description of log snippets
% python examples/classic/ascii.py 
----1----
|  |    |
|  --3--|
|   || ||
--4--| ||
 ||  | ||
 |--5--||
 |    |||
 ---2----
         

(.venv) wbkboyer@Wandas-MacBook-Pro planarity % python examples/classic/graph_formats.py 
False
False
False
False
(.venv) wbkboyer@Wandas-MacBook-Pro planarity % python examples/classic/kuratowski.py 
False
[('a', 'd'), ('a', 'c'), ('a', 'e'), ('a', 'b'), ('d', 'b'), ('d', 'c'), ('d', 'e'), ('b', 'e'), ('b', 'c'), ('e', 'c')]
True
[]
(.venv) wbkboyer@Wandas-MacBook-Pro planarity % python examples/classic/networkx_draw.py 
Ignoring fixed y limits to fulfill fixed data aspect with adjustable data limits.
(.venv) wbkboyer@Wandas-MacBook-Pro planarity % python examples/classic/networkx_interface.py 
False
[(0, 3), (0, 2), (0, 4), (0, 1), (3, 1), (3, 2), (3, 4), (2, 1), (2, 4), (4, 1)]
(.venv) wbkboyer@Wandas-MacBook-Pro planarity % python examples/classic/pgraph_class.py 
[0, 1, 2, 3, 4]
{1: 0, 2: 1, 3: 2, 4: 3, 5: 4}
[(0, 4), (0, 3), (0, 2), (0, 1), (1, 4), (1, 3), (1, 2), (2, 4), (2, 3), (3, 4)]
False
[(0, 3), (0, 2), (0, 4), (0, 1), (1, 3), (1, 4), (1, 2), (2, 4), (2, 3), (3, 4)]
----1----
|  |    |
|  --5--|
|   || ||
--4--| ||
 ||  | ||
 |--2--||
 |    |||
 ---3----
         

(.venv) wbkboyer@Wandas-MacBook-Pro planarity % python examples/classic/write_adjlist.py 
{1: 'c', 2: 'e', 3: 'd', 4: 'a', 5: 'b'}

(.venv) wbkboyer@Wandas-MacBook-Pro planarity % pytest -v 
================================================= test session starts ==================================================
platform darwin -- Python 3.14.2, pytest-9.0.3, pluggy-1.6.0 -- /Users/wbkboyer/git/planarity/.venv/bin/python3.14
cachedir: .pytest_cache
rootdir: /Users/wbkboyer/git/planarity
configfile: pyproject.toml
collected 19 items                                                                                                     

tests/test_planarity.py::TestPlanarity::test_is_planar_edgelist_input PASSED                                     [  5%]
tests/test_planarity.py::TestPlanarity::test_is_planar_edgelist_input_function PASSED                            [ 10%]
tests/test_planarity.py::TestPlanarity::test_is_planar_adj_input PASSED                                          [ 15%]
tests/test_planarity.py::TestPlanarity::test_is_planar_adj_input_function PASSED                                 [ 21%]
tests/test_planarity.py::TestPlanarity::test_is_planar_adj_symmetric PASSED                                      [ 26%]
tests/test_planarity.py::TestPlanarity::test_is_planar_adj_set PASSED                                            [ 31%]
tests/test_planarity.py::TestPlanarity::test_is_planar_adj_list PASSED                                           [ 36%]
tests/test_planarity.py::TestPlanarity::test_goldner_harary PASSED                                               [ 42%]
tests/test_planarity.py::TestPlanarity::test_kuratowski_k5 PASSED                                                [ 47%]
tests/test_planarity.py::TestPlanarity::test_kuratowski_k5_function PASSED                                       [ 52%]
tests/test_planarity.py::TestPlanarity::test_no_kuratowski_k5m PASSED                                            [ 57%]
tests/test_planarity.py::TestPlanarity::test_draw_text PASSED                                                    [ 63%]
tests/test_planarity.py::TestPlanarity::test_write_adjlist PASSED                                                [ 68%]
tests/test_planarity_networkx.py::TestPlanarityNetworkX::test_is_planar PASSED                                   [ 73%]
tests/test_planarity_networkx.py::TestPlanarityNetworkX::test_is_planar_unions PASSED                            [ 78%]
tests/test_planarity_networkx.py::TestPlanarityNetworkX::test_goldner_harary PASSED                              [ 84%]
tests/test_planarity_networkx.py::TestPlanarityNetworkX::test_kuratowski_k5 PASSED                               [ 89%]
tests/test_planarity_networkx.py::TestPlanarityNetworkX::test_kuratowski_k5m PASSED                              [ 94%]
tests/test_planarity_networkx.py::TestPlanarityNetworkX::test_networkx_graph PASSED                              [100%]

================================================== 19 passed in 0.07s ==================================================
Details

wbkboyer added 4 commits May 12, 2026 15:22
…now uses the updated endpoints. Will revert pyproject.toml + setup.py when updates are made to the planarity.full subpackage.

It's important to note that now, cgraphLib.gp_UpperBoundVertices() is meant to be used with < rather than <= for comparisons with the index of a vertex, so when iterating over vertices, no longer does the range()'s end have to be one greater than gp_GetLastVertex() to ensure the inclusion of the final vertex's index in the immutable sequence returned by range().

Also of note is that previously, we were casting the pointer to the context as a void * rather than void **, even though that's what is actually expected by cgraphLib.gp_FindExtension()... I fixed the cdef in cplanarity.pxd to match the actual function signature, and updated the cast in planarity.pyx 's PGraph class' nodes() and edges() methods.
…all_graphs.py and edge_deletion_analysis.py.

A lot of reorganization to try to ensure the declarations in the .pxd definition files appear in roughly the same order in which they appear in the graphLib headers, and ensuring Graph methods are renamed with updated calls via cgraphLib
…s in the source distribution.

I have no idea why the 0.7.11 source distribution included the headers but recent attempts did not. I tried old versions of setuptools and build packages to see if something changed with these packages, but this change now means the headers are present. Related to pypa/setuptools#1162

Confirmed successful install in test environment
@wbkboyer wbkboyer requested a review from john-boyer-phd May 16, 2026 00:16
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.

Looking great, minor tweaks

Comment thread planarity/classic/planarity.pyx Outdated
Comment thread planarity/classic/planarity.pyx
Comment thread planarity/full/cgraphLib.pxd
Comment thread planarity/full/cgraphLib.pxd
Comment thread planarity/full/graph.pyx
…populating the graph, and updated all return value checks so that we error out when staus != cplanarity.OK (rather than == cplanarity.NOTOK)

Re-ran pytest + all examples/classic/ scripts
@wbkboyer wbkboyer requested a review from john-boyer-phd May 20, 2026 19:34
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.

Looks great!

@john-boyer-phd john-boyer-phd merged commit 1c54c34 into master May 20, 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.

Merge more EAPS 5.0.0.0 changes from EAPS PRs #214 and #215

2 participants