|
|
|
|
|
by oneepic
1796 days ago
|
|
Similar to what another commenter said about time, have you tried a backtracking approach by:
(1) coloring the whole graph (let's say you end with 42 colors)
(2) start with the highest colored nodes (e.g. N=42, which exceeds your threshold of 40) and
(3) greedily remove the lowest-weight edges (or maybe, edges to other high-colored nodes) until you are either all colored with 40 colors or we reach an invalid state (ie node no longer in the graph) -- with the latter you can add another edge back and try again by removing the next-lowest edge. |
|