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.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for listcolouring-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb0f84995db4024d46730184daa16fc52d92a59815bddfe5ac29ba640f633fe7 |
|
MD5 | cb5fbb3719d7f624282369bc8e5393a0 |
|
BLAKE2b-256 | 4aa7586a519b5121a73de95ac692df87ecac1c9559008b1f4bf62517f3145748 |