-
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.
Implement first permissible or none strategy for node colouring. (#35)
* Implement first permissible or none strategy for node colouring. * Add colour attribute to nodes in tests.
- Loading branch information
1 parent
6436a1d
commit b0ee9b7
Showing
2 changed files
with
28 additions
and
1 deletion.
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,13 @@ | ||
import networkx as nx | ||
|
||
import listcolouring | ||
from listcolouring import first_permissible_or_none_node | ||
|
||
def test_first_permissible_or_none_node(): | ||
G = nx.complete_graph(3) | ||
permissible_dict = {0: [0, 1], 1: [1, 2], 2: [2, 3]} | ||
nx.set_node_attributes(G, permissible_dict, "permissible") | ||
nx.set_node_attributes(G, None, "colour") | ||
assert first_permissible_or_none_node(G, 0) == 0 | ||
assert first_permissible_or_none_node(G, 1) == 1 | ||
assert first_permissible_or_none_node(G, 2) == 2 |