I'm not able to understand the editorial of this question on graph (Codeforces)! Can someone please explain what is the approach for solving it? asked 10 Feb '18, 22:24

this question is about finding the connected component . In a fully connected graph we have maximum edges so one govt house cannot be connected to other so connect all the nodes of this component to one another and the cities which are not connected to any govt connect them to component which have maximum nodes Accepted solution answered 11 Feb '18, 08:12

I understood the following things:
@anno I couldn't understand component having maximum nodes part? answered 11 Feb '18, 10:05
1
see there may be some node or components which are not connected to any govt node so we will connect them to the component having maximum nodes so that there will be more number of edges take an example there is component with 5 node and one with 6 nodes these both have one govt node and we also have node which is not connected to any govt node if we will connect it with 5 number of edges that will increase will be 5 (we will connect it to all nodes of that component ) but if we will connect it to component having 6 nodes number of edges that will increase will be 6
(11 Feb '18, 18:33)
1
so make a component of all the nodes which are not connected to any govt node and connect that to component having maximum nodes so that we can have more increase in number of edges
(11 Feb '18, 18:34)
thanks :) it helped
(11 Feb '18, 22:55)
