Hi,
I want to color a region in such a way that no neighboring regions have the same color.
I have already found some literature about 4-Color and 6-color theorems, which are minimum number of color that can be used to achieve unique coloring of a map where no neighboring regions share the same color, but not sufficient to be able to develop a code-able algorithm.
Is there any one who has tried to code these, or has an idea how the algorithm should be and how to code?
Best regards,
Comments
pritaeas
: I want to color a region in such a way that no neighboring regions
: have the same color.
:
: Is there any one who has tried to code these, or has an idea how the
: algorithm should be and how to code?
I have a real country map divided into zones (regions). There are no specific information about these reions except their point co-ordinates.
These co-ordinates define the boundaries of the region and the centroid.
I can identify each region using these informations. I can make a list of neighbours for each region, and then check their colors.
The question is to do this coloring with fewest colors in fastest time.
My idea is, for each region, check the list of neighbours regions for used colors, and pick the "not in use" color. Run through all regions of the map.
monader
: Hi. I've only done this for a square grid map, containing sections of any size. Can you check (the color of ) your neighbouring regions? If so, it could be fairly straightforward. How are your regions defined? Is it a real map? Note that the max number of colors is defined by the actual max number of neighbours for one cell plus one.
:
: pritaeas
:
: : I want to color a region in such a way that no neighboring regions
: : have the same color.
: :
: : Is there any one who has tried to code these, or has an idea how the
: : algorithm should be and how to code?
:
go through all the regions
check for every region to find a color from the stack that is not assigned to any neighbour. if u find none, create a random one and add it to the stack
that is what popped up my mind just now, it might not be the best idea, and it might be even the worst idea, but it should work fine.
: Hi,
: I have a real country map divided into zones (regions). There are no specific information about these reions except their point co-ordinates.
: These co-ordinates define the boundaries of the region and the centroid.
:
: I can identify each region using these informations. I can make a list of neighbours for each region, and then check their colors.
: The question is to do this coloring with fewest colors in fastest time.
:
: My idea is, for each region, check the list of neighbours regions for used colors, and pick the "not in use" color. Run through all regions of the map.
:
: monader
:
:
:
: : Hi. I've only done this for a square grid map, containing sections of any size. Can you check (the color of ) your neighbouring regions? If so, it could be fairly straightforward. How are your regions defined? Is it a real map? Note that the max number of colors is defined by the actual max number of neighbours for one cell plus one.
: :
: : pritaeas
: :
: : : I want to color a region in such a way that no neighboring regions
: : : have the same color.
: : :
: : : Is there any one who has tried to code these, or has an idea how the
: : : algorithm should be and how to code?
: :
:
:
[hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: I can identify each region using these informations. I can make a
: list of neighbours for each region, and then check their colors.
: The question is to do this coloring with fewest colors in fastest
: time.
:
: My idea is, for each region, check the list of neighbours regions for
: used colors, and pick the "not in use" color. Run through all regions
: of the map.