Karger implementation