Implemented looped random contraction for undirected graph adjacency list