Let's consider the cluster as a non-empty set of edges that can be divided into one or more cycles so that exactly one cycle went along each edge of the chosen set. Besides, each cycle can consist only of edges from the chosen set. Cluster doesn't have to be connected.
We keep on adding edges in our graph, and as we add edge we count the number of ways of forming a cluster.
The solution to this problem is that let ans be 1 initially. Now as we add an edge between u and v, and if they are in same component then multiply ans by 2. Final answer after adding an edge would be (ans-1).
Why is this correct?
Problem Link
Explanation that is not clear to me.