Input: a weighted graph which has already been
merged into groups as in the MERGING algorithm,
Output: a contracted graph with edge weights.
List all groups of after the MERGING step as
Generate a new vertex to represent the group .
for to
 for to
  
  
Algorithm 4: CONTRACTION algorithm.