karger algo: improvement