#NEWLINE# def test_min_cut( self ) : #NEWLINE# #INDENT# G = zen . DiGraph ( ) #NEWLINE# G . add_node ( 'a' ) #NEWLINE# G . add_node ( 'b' ) #NEWLINE# G . add_node ( 'c' ) #NEWLINE# G . add_node ( 'd' ) #NEWLINE# G . add_node ( 'e' ) #NEWLINE# G . add_node ( 'f' ) #NEWLINE# G . add_node ( 'g' ) #NEWLINE# G . add_node ( 'h' ) #NEWLINE# G . add_edge ( 'a' , 'b' , weight = 10 ) #NEWLINE# G . add_edge ( 'a' , 'c' , weight = 5 ) #NEWLINE# G . add_edge ( 'a' , 'd' , weight = 15 ) #NEWLINE# G . add_edge ( 'b' , 'e' , weight = 9 ) #NEWLINE# G . add_edge ( 'b' , 'f' , weight = 15 ) #NEWLINE# G . add_edge ( 'b' , 'c' , weight = 4 ) #NEWLINE# G . add_edge ( 'c' , 'f' , weight = 8 ) #NEWLINE# G . add_edge ( 'c' , 'd' , weight = 4 ) #NEWLINE# G . add_edge ( 'd' , 'g' , weight = 30 ) #NEWLINE# G . add_edge ( 'g' , 'c' , weight = 6 ) #NEWLINE# G . add_edge ( 'e' , 'f' , weight = 15 ) #NEWLINE# G . add_edge ( 'e' , 'h' , weight = 10 ) #NEWLINE# G . add_edge ( 'f' , 'g' , weight = 15 ) #NEWLINE# G . add_edge ( 'f' , 'h' , weight = 10 ) #NEWLINE# G . add_edge ( 'g' , 'h' , weight = 10 ) #NEWLINE# self . assertEquals ( 28 , zen . min_cut ( G , 'a' , 'h' , 'weight' ) ) #NEWLINE# self . assertEquals ( 3 , zen . min_cut ( G , 'a' , 'h' , 'unit' ) ) #NEWLINE# G . set_weight ( 'd' , 'g' , float ( 'inf' ) ) #NEWLINE# self . assertEquals ( 28 , zen . min_cut_ ( G , 0 , 7 , 'weight' ) ) #NEWLINE# self . assertEquals ( 3 , zen . min_cut_ ( G , 0 , 7 , 'unit' ) ) #NEWLINE# G . set_weight ( 'a' , 'c' , float ( 'inf' ) ) #NEWLINE# G . set_weight ( 'c' , 'f' , float ( 'inf' ) ) #NEWLINE# G . set_weight ( 'f' , 'h' , float ( 'inf' ) ) #NEWLINE# self . assertEquals ( float ( 'inf' ) , zen . min_cut ( G , 'a' , 'h' , 'weight' ) ) #NEWLINE# self . assertEquals ( 3 , zen . min_cut ( G , 'a' , 'h' , 'unit' ) )