Solving the minimum cut problem for undirected graphs