Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. Linus Torvalds

Two color a map with no more than four colors

Language Java | Level Intermediate | Category Algorithms | August 3, 2015 9:43 pm


Algorithm Problem Description

Given any separation of a plane into contiguous regions, producing a figure called a map, no more than four colors are required to color the regions of the map so that no two adjacent regions have the same color.

Write a program to implement four color theorem?

Output

          	        
          	        

Number of vertices : 4
Number of colors : 3
Adjacency matrix : 
0 1 1 1 
1 0 1 0 
1 1 0 1 
1 1 1 0 

Coloring(V C) #  1-->	(1 1)	(2 2)	(3 3)	(4 2)
Coloring(V C) #  2-->	(1 1)	(2 3)	(3 2)	(4 3)
Coloring(V C) #  3-->	(1 2)	(2 1)	(3 3)	(4 1)
Coloring(V C) #  4-->	(1 2)	(2 3)	(3 1)	(4 3)
Coloring(V C) #  5-->	(1 3)	(2 1)	(3 2)	(4 1)
Coloring(V C) #  6-->	(1 3)	(2 2)	(3 1)	(4 2)
total number of solutions : 6

          	        
          	        				    


Comments



Please login to add comments.