List colouring in Python with NetworkX.
Project description
list-colouring
List colouring in Python with NetworkX.
import networkx as nx
import matplotlib.pyplot as plt
import listcolouring
from listcolouring import list_init, greedy_list_edge_colouring, print_list_edge_colouring
G = nx.petersen_graph()
G = list_init(G, range(0, 10), 3, 0)
G = greedy_list_edge_colouring(G)
options = {'with_labels': True, 'node_color': "white"}
colors = nx.get_edge_attributes(G,'colour').values()
nx.draw_shell(G, nlist = [range(5, 10), range(5)], edge_color = colors, **options)
plt.savefig("img/petersen-shell.png", format = "PNG"
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
listcolouring-0.1.0.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for listcolouring-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9940aa0e3e56f830223ab2b2cb6ac1403ea3853912c858f3ae5c5bec5837ab1b |
|
MD5 | 1878f27031047031582de1679cf8ef1b |
|
BLAKE2b-256 | a8c5ccaba7f5e9e6e8688e51c08dac5e13fca86f9e54553fb2b9e105d67ce962 |