Skip to main content

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.

Metadata

Release files for planarity 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for planarity 1.0.0
File Size Uploaded
planarity-1.0.0.tar.gz 682.5 kB Details

Release files / planarity-1.0.0.tar.gz

Download URL planarity-1.0.0.tar.gz
Size 682.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9129d2429fc54c70a976cdf59b21a9c6a542466cf49747c1bbce1f27d59f4f3e
BLAKE2b-256 checksum
How to use checksums
9b042321173a19ac665382b7165f89d1da3c162ae4f8802f6d9efbea7237d544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

0.6

1 release file

0.5

1 release file

0.4.1

2 release files

0.4

2 release files

0.3.1

2 release files

0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page