skillfed

planarity

Python Wrapper for the Edge Addition Planarity Suite and Graph Library

planarity v1.0.0 709.6K downloads/30d#5,262 on PyPI43
Permissive license BSD-3-Clause Active released

What it is and what it does

Planarity is a Python wrapper around the Edge Addition Planarity Suite (EAPS), a high-performance C library for planar graph algorithms. It provides functions to test whether a graph is planar, compute planar embeddings, generate ASCII-art drawings of planar graphs, and detect forbidden subgraphs. The package has no runtime dependencies and is designed for developers and researchers working with graph theory, discrete mathematics, and algorithm development.

The package accepts graphs as edge lists (tuples of vertex labels) and returns results as booleans, dictionaries, or formatted strings. It is production-stable (Development Status 5) and actively maintained, with support for modern Python versions (3.10–3.14). However, installation requires compilation from source, which adds friction on platforms without a C compiler readily available.

Use it for:

  • Verify whether a network topology or circuit diagram can be drawn without edge crossings before layout algorithms.
  • Detect and isolate forbidden subgraphs (like K5 or K3,3) in graph-based data structures for constraint checking.
  • Generate quick ASCII visualizations of small planar graphs for debugging or documentation.
  • Integrate planar graph testing into NetworkX-based graph analysis pipelines.
  • Benchmark or validate planar graph algorithms in academic research or algorithm development.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Tests whether a graph is planar, computes planar embeddings, draws planar graphs as ASCII art, and isolates forbidden subgraphs using algorithms from the Edge Addition Planarity Suite.

Yes, if you need planar graph algorithms and can handle compilation. The package is stable, actively maintained, permissively licensed, and has no runtime dependencies. High install friction (source compilation required) is the main drawback; verify your build environment supports C compilation before installing. No known security vulnerabilities.

Install

planarity on PyPI

pip

pip install planarity

uv

uv add planarity

poetry

poetry add planarity

Installing planarity

Before you install

High install friction: the package requires compilation from source (tar.gz distribution). Maintenance is active with a recent release (46 days ago) and ongoing repository commits, supporting Python 3.10 through 3.14.

License in practice

BSD-3-Clause permissive license allows commercial and private use with attribution. The license covers both the Python wrapper and the underlying Edge Addition Planarity Suite (EAPS) C library.

Quickstart

import planarity

edgelist = [('a', 'b'), ('a', 'c'), ('b', 'c')]
print(planarity.is_planar(edgelist))  # True
print(planarity.ascii(edgelist))  # ASCII drawing
print(planarity.mapping(edgelist))  # Vertex label to index mapping

Requires Python >= 3.10 and a C compiler to build from source (high install friction).

Verify before relying

  • Whether NetworkX integration is automatic or requires explicit setup beyond import.
  • Performance characteristics on large graphs (vertex/edge count thresholds).
  • Which specific forbidden subgraph algorithms are exposed in the public API.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction high — source build required
Runtime dependencies none
Maintenance actively maintained — 46 days since the last release
Last repo commit
First released
Downloads 709,596/month — #5,262 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: planarity-1.0.0.tar.gz

Keywords: Graph Theory, Mathematics, Discrete Mathematics, Graph Algorithms, graph, algorithms, math

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: CProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Bio-InformaticsTopic :: Scientific/Engineering :: ChemistryTopic :: Scientific/Engineering :: Electronic Design Automation (EDA)Topic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: PhysicsTopic :: Scientific/Engineering :: VisualizationTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

planar graph testinggraph planarity checkplanar embedding algorithmforbidden subgraph detectiongraph drawing asciiplanarity testing librarygraph algorithms python
graph-algorithmsplanar-graphscomputational-geometry

More Libraries packages