MHenderson / listcolouring

List colouring in Python with NetworkX.

Home Page:https://listcolouring.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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"

About

List colouring in Python with NetworkX.

https://listcolouring.readthedocs.io/en/latest/

License:MIT License


Languages

Language:Python 95.4%Language:Makefile 4.6%