Input: a weighted graph .
Output: clustering dendrogram of the graph .
(Initialization) ,
while
 (GROUPING) Cluster the vertices in into different groups.
 (MERGING) Merge those groups with large percentage of overlap.
 (CONTRACTION) Contract those vertices in the same groups to a new vertex,
 calculate the edge weights in the contracted graph.
 Denote the contracted graph as , .
Algorithm 1: CGC algorithm.