MHenderson / vizing

Constraint-based list-colouring in Python
https://pypi.org/project/vizing/
0 stars 0 forks source link

Total list-colouring fails sometimes #24

Open MHenderson opened 5 days ago

MHenderson commented 5 days ago
G = nx.complete_graph(3)

permissible_dict_edge = {(0, 1): [0, 1], (0, 2): [1, 2], (1, 2): [2, 4]}
nx.set_edge_attributes(G, permissible_dict_edge, "permissible")
nx.set_edge_attributes(G, None, "colour")
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")

total_list_colouring_solution(G)
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-12-c35ef55e0995> in <cell line: 10>()
      8 nx.set_node_attributes(G, None, "colour")
      9 
---> 10 total_list_colouring_solution(G)

3 frames

/usr/local/lib/python3.10/dist-packages/constraint/__init__.py in getSolutionIter(self, domains, constraints, vconstraints)
    492                 for variable in domains
    493             ]
--> 494             lst.sort()
    495             for item in lst:
    496                 if item[-1] not in assignments:

TypeError: '<' not supported between instances of 'tuple' and 'int'
MHenderson commented 5 days ago

Probably has something to do with using a combination of tuples and integers as variables in constraints (but that works in other cases).