class and layout for the min cut algorithm
min cut finished (answer 17)