Min-cut and Connected Graph component [by python]