Skip to content

Issue #99: Add label_type option to Express API draw() - #111

Merged
john-boyer-phd merged 3 commits into
graph-algorithms:masterfrom
hagberg:Issue99-NumericLabelsForDraw
Oct 13, 2026
Merged

john-boyer-phd merged 3 commits into
graph-algorithms:masterfrom
hagberg:Issue99-NumericLabelsForDraw

Conversation

@hagberg

@hagberg hagberg commented Oct 12, 2026

Copy link
Copy Markdown
Member

Adds label_type ('default', 'label', 'index') to PGraph.draw() and planarity.draw(). 'index' labels vertices with the numeric indexes used by ascii(); other values raise ValueError. Includes tests and an example.

Addresses #99

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

Updated

  • planarity/express/planarity.pyx - PGraph.draw() gains a label_type parameter (default 'default'). 'default' and 'label' show the original vertex labels as before; 'index' shows the numeric vertex indexes.
  • planarity/express/planarity_functions.py - planarity.draw() accepts label_type.
  • tests/test_express_api_draw_labels.py - Tests for each label_type value at both the function and method level.

Testing

  • Full test suite passes locally (pytest -vv), including the new label_type tests

hagberg and others added 3 commits October 12, 2026 08:56
Adds label_type ('default', 'label', 'index') to PGraph.draw() and planarity.draw(). 'index' labels vertices with the numeric indexes used by ascii(); other values raise ValueError. Includes tests and an example.
…o planarity_functions.py

Co-authored-by: Aric Hagberg <aric.hagberg@gmail.com>

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for adding this Aric, it's delightful to have the flexibility to get an image version of the textual rendition. Although I accidentally omitted mentioning it in the issue, I added generating this new image variant to the express API example draw.py (and I spruced up what it says when run on the command line). I also replaced your label_type docstring in planarity_functions.py with your better version that was in planarity.pyx. I added a co-authored-by line because it was your docstring that I copied over ^_^

@john-boyer-phd
john-boyer-phd merged commit 92e63d1 into graph-algorithms:master Oct 13, 2026
4 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.

2 participants