Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mhenderson/listcolouring

List colouring in Python with NetworkX.
https://github.com/mhenderson/listcolouring

graph-colouring graphs networkx python

Last synced: about 1 month ago
JSON representation

List colouring in Python with NetworkX.

Awesome Lists containing this project

README

        

# listcolouring
List colouring in Python with NetworkX.

```python
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"
```