Karger's naive implementation