Karger's Contraction algorithm (Programming Question 3) completed.