this library provides support to construct graphs and their coloring graphs. a coloring graph is a metagraph representing all the valid colorings of a graph. each vertex of a coloring graph represents a coloring of the base graph.
Project description
libcolgraph
libcolgraph homepage on the web
a coloring graphs library written in C++ for speedy computation and wrapped in Python for ease of development and extension!
what
this library provides support to construct graphs, their coloring graphs, and biconnected component metagraphs. a coloring graph is a graph representing all the valid colorings of a graph. each vertex of a coloring graph represents a coloring of the base graph. two colorings are considered adjacent if they differ in only one vertex's color.
in this project, we represent a coloring as an integer, which, when converted to base k (for a k-coloring), is a number of length |V| and represents the vertex-wise colors [0,k) for each vertex.
the library is under development, being written using Python and C/C++.
the web application uses the library to provide useful GUI for quick drawing and
graph construction.
in the future, we plan to develop a supplemental subsection of the library containing
useful graph algorithms and ability to run simulations to test structural graph theoretic
conjectures about graph coloring and coloring graphs.
for documentation, feel free to take a look inside libcolgraph/
and read the docstrings.
for questions, reach out.
screenshot of the web GUI
[Clockwise] A 7 vertex BaseGraph that is a hexagon with a central vertex and a missing 'spoke' leads to a quite complex ColoringGraph with k=4 colors. You can see the formation of polyps at the edges. The structure of the resultant ColoringGraph is shown in the Meta ColoringGraph produced by a run of modified Tarjan's algorithm for biconnected components. The central 'mothership' can be seen, adjacent to which there are cut vertices, and finally the stray singular coloring vertices at the tips of polyps.
for a static demo, go to the project's gitlab pages.
usage
-
as a module
plot a BaseGraph, its ColoringGraph, and the Meta ColoringGraph generated by Tarjans. you would need to have a graph formatted in an adjacency matrix file. opens plots in new browser windows.
launch web GUI:
libcolgraph.web [-h] [-i INPUT_FILE] [-n] [-s] [-k COLORS] [-v] [-p PORT] [-w] [-r] [-d] [-t] optional arguments: -h, --help show this help message and exit -i INPUT_FILE, --input-file INPUT_FILE read in BaseGraph from adjacency matrix file -n, --new open a blank canvas? -s, --select_file open file choosing gui dialogue? -k COLORS, --colors COLORS number of colors to use to create ColoringGraph -v, --verbosity set output verbosity -p PORT, --port PORT port to launch GUI on -w, --webbrowser open app in default web browser window? -r, --render_on_launch render to-generate componenets on initial launch? -d, --debug launch Flask app in debug mode? -t, --threaded allow multiple threads?
-
as a library
import libcolgraph bg = libcolgraph.BaseGraph() bg.load_txt('./in/hexmod.in') cg = bg.build_coloring_graph(4) print('bg {} led to a cg {}'.format(bg, cg)) for v in cg.get_vertices(): print(v)
installation
-
for installation from source refer to detailed install instructions
-
python3 -m pip install libcolgraph [--upgrade]
things to note:
- currently a binary wheel is available only for
manylinux
distributions e.g. centOS, Debian family, RedHat family, etc. - if your distribution is not
manylinux
-supported, then pip will need to compile locally usingswig
andsetuptools
. in that case, make sure you havesetuptools
and swig installed, as they will be needed for compilation. - we periodically release wheels for MacOS as well. these
might not be as frequently maintained, however, so your best
bet would be to compile locally using
swig
.
- currently a binary wheel is available only for
contribute
help
visit full API documentation
who
Coloring Graphs lab, University of Richmond. (C) 2017-2020
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file libcolgraph-0.0.7.tar.gz
.
File metadata
- Download URL: libcolgraph-0.0.7.tar.gz
- Upload date:
- Size: 280.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6798649a83326933a3f0ebbe8ba24f4d3db912973d2bf980725860c0b6bbe2b2 |
|
MD5 | c0ea1cb01bbdc0240a72e93abf47fe84 |
|
BLAKE2b-256 | 8133122e7b27d917e663297e2bcd5a02bf4c6d2257a7ab693e8ebe27edb848f4 |
File details
Details for the file libcolgraph-0.0.7-cp35-cp35m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: libcolgraph-0.0.7-cp35-cp35m-manylinux2010_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4691fb12df5963355d1a92c7479765688b8547aa38a328d09840e376d7e5729 |
|
MD5 | a026f68e3a48e6c90efe3260a9a176a3 |
|
BLAKE2b-256 | 9d6fcb1ea27979eab57868caa5affc023bc20993ed5c8403b7b9e7e58db85d36 |