6 which points of a graph are connected?.
7 Union find, a standard algorithm:
9 Union_find represents an undirected graph of N points. You can
10 connect two points using #connect()#. #find(i)# finds a uniquely
11 determined representant of the equivalence class of points
16 void connect(int i
, int j
);
18 bool equiv(int i
, int j
) { return find(i
) == find(j
); }