Skip to main content

Equitable coloring for networkX graphs.

Project description

Equitable coloring for networkX graphs.

From Wikipedia:

In graph theory [..] an equitable coloring is an assignment of colors to the vertices of an undirected graph, in such a way that

  • No two adjacent vertices have the same color, and

  • The numbers of vertices in any two color classes differ by at most one.

Kierstead et. al. have provided a fast polynomial time algorithm for uncovering an equitable coloring using r + 1 colors for a graph with maximum degree r. This package is an implementation of the algorithm for networkX graphs.

  • Free software: MIT license

Installation

pip install equitable-coloring

Usage

To use equitable-coloring:

>>> import networkx as nx
>>> from equitable_coloring import equitable_color
>>> from equitable_coloring.utils import is_equitable
>>> G = nx.cycle_graph(4)
>>> d = equitable_color(G, num_colors=3)
>>> is_equitable(G, d)
True

Documentation

https://equitable-coloring.readthedocs.io/

Development

To run the all tests run:

pip install pytest-cov  # Needed the first time.
python setup.py test

Or, you can use tox.

Changelog

0.1.2 (2018-06-30)

  • Update README and usage instructions.

0.1.1 (2018-06-30)

  • Initial version with tests.

0.1.0 (2018-06-11)

  • First commit.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

equitable_coloring-0.1.2-py2.py3-none-any.whl (15.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file equitable_coloring-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for equitable_coloring-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0573cde9e529a0ebd841a7c3f40bd901f78f60792497dfbf08bf98d5720e033a
MD5 614d106210840cbdd549bcd0a6651c19
BLAKE2b-256 57ccca3099b2871d445a941f1bd8ba6a4373872d94313692ccb8ea3461db7d63

See more details on using hashes here.

Supported by

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