List colouring in Python with NetworkX.
Project description
listcolouring
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.3.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for listcolouring-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1302c7b1344425187b027c3d370523ea6a7ac573c2aa00ce3158e6f7b493a7d2 |
|
MD5 | f32c6809abacf8d2bd5991077f25c39b |
|
BLAKE2b-256 | be8965b7678d5ffb962e41edd6c9417ec81dc5abb523a9cc63daf2a895caebf1 |