Hi guyz,
I'm working with a brute force algorithm for graph coloring...
But, there is something that is blowing my mind.
In general, my code works.
My trouble lies with the follow error:
When my graph has less than 7 (excluded) nodes, everything goes well.
But for 7 or more, this happens:
Example1:
Code:
Graph with 7 nodes:
Node 0: 1
Node 1: 2
Node 2: 3
Node 3: 4
Node 4: 2
Node 5: 3
Node 6: 7
Example 2:
Code:
Graph with 70 nodes:
Node 0: 1
Node 1: 2
Node 2: 3
Node 3: 4
Node 4: 2
Node 5: 3
Node 6: 70
Node 7: 1
Node 8: 2
...
Node 69: 1
For all situations, it works well for all nodes, except for 6th, who gets the number of nodes of graph!
My code is in portugues, but i think that you can understand it easy.
EDIT: The problem was with the dynamic allocation of the array that recieves the node's color.