Fixed a minimum cut bug for weighted undirected graphs (#564).