Skip to main content

A Python Library for Graph Coloring

Project description

GCol

DOI

GCol is an open-source Python library for graph coloring, built on top of NetworkX. It provides easy-to-use, high-performance algorithms for node coloring, edge coloring, face coloring, equitable coloring, weighted coloring, precoloring, and maximum independent set identification. It also offers several tools for solution visualization.

In general, graph coloring problems are NP-hard. This library therefore offers both exponential-time exact algorithms and polynomial-time heuristic algorithms.

Quick Start

To install the GCol library, type the following at the command prompt:

python -m pip install gcol

or execute the following in a notebook:

!python -m pip install gcol

To start using this library, try executing the following code.

import networkx as nx
import matplotlib.pyplot as plt
import gcol

G = nx.dodecahedral_graph()
c = gcol.node_coloring(G)
print("Here is a node coloring of graph G:", c)
nx.draw_networkx(G, node_color=gcol.get_node_colors(G, c))
plt.show()

Textbook

The algorithms and techniques used in this library come from the 2021 textbook by Lewis, R. (2021) A Guide to Graph Colouring: Algorithms and Applications, Springer Cham. (2nd Edition). In bibtex, this book is cited as:

@book{10.1007/978-3-030-81054-2,
  author = {Lewis, R. M. R.},
  title = {A Guide to Graph Colouring: Algorithms and Applications},
  year = {2021},
  isbn = {978-3-030-81056-6},
  publisher = {Springer Cham},
  edition = {2nd}
}

A short description of this library is also published in the Journal of Open Source Software:

@article{10.21105/joss.07871,
  author = {Lewis, R. and Palmer, G.},
  title = {GCol: A High-Performance Python Library for Graph Colouring},
  journal = {Journal of Open Source Software},
  year = {2025},
  volume = {10},
  number = {108},
  pages = {7871},
  doi = {10.21105/joss.07871}
}

Support

The GCol repository is hosted on github. If you have any questions or issues, please ask them on stackoverflow, adding the tag graph-coloring. All documentation is listed on this website or, if you prefer in, this pdf. If you have any suggestions for this library or notice any bugs, please contact the author using the contact details at www.rhydlewis.eu.

Project details


Download files

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

Source Distribution

gcol-2.0.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcol-2.0-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file gcol-2.0.tar.gz.

File metadata

  • Download URL: gcol-2.0.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for gcol-2.0.tar.gz
Algorithm Hash digest
SHA256 a28d143983ad41a4ba0bf609aaac4feb53ee6398ad09d7167b30c70fe82da6b0
MD5 11d6c99c2836309189f2b55528e98a7d
BLAKE2b-256 a30ee4d7b6d7ff4c2fd81f21ce1d4bf6dddcd78bcb1b392e1ab85531142707fd

See more details on using hashes here.

File details

Details for the file gcol-2.0-py3-none-any.whl.

File metadata

  • Download URL: gcol-2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for gcol-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4dd5dd9ba031bbb8583900454f5ea34cddab1aa66efd8fe838a8e3363a2776
MD5 4e37366b8d3de6e954f64a4170453664
BLAKE2b-256 66e77629a4059a3d8c7e41774d88f26610196052daa702964a77acb2376027ef

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