Fix getting minimum weight for graphs which include null weights