Here is my code for the karger min cut algorithm.. To the best of my knowledge the algorithm i have implemented is right. But I don get the answer right. If someone can check wh
As stated by Phil, I had to run my program 100 times. And one more correction in the code was :
for edge in edgelist:
if edge[0] == edge[1]:
edgelist.remove(edge)
This part of the code did not correctly eliminate the self loops. So I had to change the code like :
for i in range((len(edgelist)-1),-1,-1):
if edgelist[i][0] == edgelist[i][1]:
edgelist.remove(edgelist[i])
And this line was not needed. since the target node would be automatically changed to self loop and it would be removed.
edgelist.remove(target_edge)
Then as said earlier, the program was looped for 100 times, and I got the minimum cut by randomization. :)