Skip to main content

Python Wrapper for the Edge Addition Planarity Suite and Graph Library

Project description

Planarity

The planarity repository provides the source code for the planarity Python package. The planarity package was originally developed to provide Python and NetworkX developers with a Python API to access planar graph testing, embedding, drawing, and forbidden subgraph isolation algorithms from the Edge Addition Planarity Suite (EAPS).

The planarity repository has now been transferred to the Github Graph Algorithms Organization. The planarity repository and Python package have been updated with the full set of planarity-related algorithms from EAPS as well as all public methods from its generalized graph library to enable development of a wide range of high-performance graph algorithms and applications.

Example

In [1]: # Example of the complete graph of 5 nodes, K5

In [2]: # K5 is not planar

In [3]: import planarity

In [4]: edgelist = [('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'),
   ...:             ('b', 'c'),('b', 'd'),('b', 'e'),
   ...:             ('c', 'd'), ('c', 'e'),
   ...:             ('d', 'e')]

In [5]: print(planarity.is_planar(edgelist))
False

In [6]: # remove an edge to make the graph planar

In [7]: edgelist.remove(('a','b'))

In [8]: print(planarity.is_planar(edgelist))
True

In [9]: # make an ascii text drawing

In [10]: print(planarity.ascii(edgelist))
----1----
| | |   |
| | -3--|
| |  ||||
| -2--|||
|  |  |||
---4---||
 |     ||
 ---5----
In [11]: # Shows correspondence between vertex labels and indices

In [12]: print(planarity.mapping(edgelist))
{1: 'd', 2: 'c', 3: 'e', 4: 'a', 5: 'b'}

See here for more examples.

For further details on development setup and installation, please see this wiki page on the planarity repository.

License

Planarity (the 'planarity' Python package; the software) is released under this BSD-3-Clause license.

Copyright (c) 2016-2026, Planarity Developers
John M. Boyer john.boyer.phd@gmail.com
Wanda B. K. Boyer wbkboyer@gmail.com
Aric Hagberg aric.hagberg@gmail.com
All rights reserved.

Planarity includes the Edge Addition Planarity Suite, which is
Copyright (c) 1997-2026, John M. Boyer.
The BSD-3-Clause license for the Edge Additional Planarity Suite included in Planarity appears here.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

planarity-1.0.0.tar.gz (682.5 kB view details)

Uploaded Source

File details

Details for the file planarity-1.0.0.tar.gz.

File metadata

  • Download URL: planarity-1.0.0.tar.gz
  • Upload date:
  • Size: 682.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for planarity-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9129d2429fc54c70a976cdf59b21a9c6a542466cf49747c1bbce1f27d59f4f3e
MD5 ecf9c6a4f8cb72b4d24d633e9285b4b6
BLAKE2b-256 9b042321173a19ac665382b7165f89d1da3c162ae4f8802f6d9efbea7237d544

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page