@saurab,
if you are finding difficulty,
just color the vertices ( but not as chromatic number )
For getting no.of connected components, all adjacent vertices should be colored with same color
Note that For getting no.of chromatic number, all adjacent vertices should be colored with different color