Skip to content

Issue #73 - add draw() endpoint to classic api - #81

Draft
wbkboyer wants to merge 8 commits into
masterfrom
Issue73-AddDrawEndpointToClassicAPI
Draft

Issue #73 - add draw() endpoint to classic api#81
wbkboyer wants to merge 8 commits into
masterfrom
Issue73-AddDrawEndpointToClassicAPI

Conversation

@wbkboyer

@wbkboyer wbkboyer commented Sep 2, 2026

Copy link
Copy Markdown
Member

Resolves #73

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

  • doc/source/_static/.gitignore and doc/source/_templates/.gitignore - ensures that these subdirectories exist when building documentation locally.
  • examples/classic/draw.py - after extending with DrawPlanar and producing a planar embedding, output both the ASCII rendition and the image generated by Matplotlib.

Updated

  • setup.py - added commented-out lines for extra_compile_args to specify for each Extension() (e.g., enable debug NOTOK statements via -DDEBUG flag)
  • doc/source/conf.py - added dependency sphinx.ext.intersphinx to allow docstrings to link to external projects' documentation (i.e. both the Python docs and NetworkX have object.inv to facilitate this linking). Also, generated docs now include classic API.
  • planarity/full/graphLib.pyx - enclosed N.N.N.N with backtics in gp_GetProjectVersionFull()'s docstring to prevent erroneous submodule dot notation resolution, and for consistency did the same to N:N:N in gp_GetLibPlanarityVersionFull(). Also fixed spacing in Returns: block of gp_GetQuietMode()'s docstring.
  • examples/classic/networkx_draw.py - updated to use the draw() function (moved to planarity_functions.py
  • planarity/classic/planarity_functions.py - moved draw() function from planarity_networkx.py module, and refactored it so that it constructs a PGraph from the input graph (NOTE Need to refactor so that we just use the PGraph that was passed in without creating a new PGraph; likely requires update to PGraph's __init__()). Then, calls the PGraph's draw() method.
  • planarity/classic/planarity_networkx.py - moved draw() function to planarity_functions.py module
  • planarity/classic/planarity.pyx
    • Added docstrings to all methods of PGraph.
    • Added embedding_code_string() helper function to be used when reporting error states from PGraph attribute embedding.
    • Manually fixed myriad linting errors using cython-lint to find problems.
    • Documenting why we're comparing against -1 for values from getters (e.g. gp_DrawPlanar_GetVertexEnd()): DrawPlanar context contains geometric positioning rather than vertex indices (hence why it's inappropriate to compare against NIL).
    • Added more stringent checks to make sure we don't ever try to run gp_Embed() twice in a row
  • planarity/classic/cplanarity.pxd - fixed syntax errors, fixed return type of gp_SortVertices(), and exposed NIL from appconst.h (even though it's not used... debating whether it should be removed for now)
  • planarity/classic/planarity.c, planarity/full/graph.c, planarity/full/graphLib.c all refreshed with Cython 3.30

Removed

  • N/A

Testing

  • Outline manual or automated tests performed and how it relates to the particular feature added or functionality changed
    • Ran pytest -vvv locally, and all existing classic API tests pass (might consider adding one for draw(), but since the output is a .png produced by Matplotlib's pyplot, I'm not sure how effective such a test would be...)
    • Ran examples/classic/draw.py and cross-referenced the ASCII rendition with the .png using the mapping()
    • Generated docs by running make html from the doc directory
  • 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

…ethod steps, and to create new `examples/classic/draw.py` to demo the code.
…ever, there appears to be a mismatch bewteen the labelling of the nodes in the .png and the ascii drawing, when considering the mapping (i.e. the edge that was removed appears in the output)
…nx dependency for autodoc creation to allow for hyperlinking with networkx and python docs. Ensure doc/source/_static and doc/source/_templates directories exist in the repo to prevent sphinx errors.
…g references. This led to discovery of a few warts in existing docstrings. Additionally, can't figure out how to abbreviate `typing.Any` to `Any` in typehints such that `intersphinx` (or `napoleon`??) extension resolves and creates the hyperlink.
….classic` package's module `planarity_functions.py`.
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.

Add draw() to PGraph class methods

1 participant