-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implementation of greedy list total colouring. (#39)
- Loading branch information
1 parent
b760f1b
commit 8043b0a
Showing
2 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import networkx as nx | ||
|
||
import listcolouring | ||
from listcolouring import greedy_list_total_colouring | ||
|
||
def test_greedy_list_total_colouring(): | ||
G = nx.complete_graph(3) | ||
permissible_dict_node = {0: [0, 1], 1: [1, 2], 2: [2, 4]} | ||
nx.set_node_attributes(G, permissible_dict_node, "permissible") | ||
nx.set_node_attributes(G, None, "colour") | ||
nx.set_edge_attributes(G, [1, 2, 3], "permissible") | ||
nx.set_edge_attributes(G, 2, "colour") | ||
G = greedy_list_total_colouring(G) | ||
assert G.nodes[0]["colour"] == 0 | ||
assert G.nodes[1]["colour"] == 2 | ||
assert G.nodes[2]["colour"] == 4 |