How to solve this problems on UVA ?

I am trying to solve this problems Problem.I think the solution is to find the number of connected components for the given graph.
So by doing a simple DFS we can get the no of connected components.
Am I right or not ?

No, As the question states that b will get light up if a does which means that graph is directed.
so if u are talking about strongly connected components in directed graph, it will not help you
because in the input 2 you will observe that no of SCC is 4.