#NEWLINE# def test_project_weighted_jaccard( self ) : #NEWLINE# #INDENT# edges = [ ( 'A' , 'B' , ( 2 / 5.0 ) ) , ( 'A' , 'C' , ( 1 / 2.0 ) ) , ( 'B' , 'C' , ( 1 / 5.0 ) ) , ( 'B' , 'D' , ( 1 / 5.0 ) ) , ( 'B' , 'E' , ( 2 / 6.0 ) ) , ( 'E' , 'F' , ( 1 / 3.0 ) ) ] #NEWLINE# Panswer = nx . Graph ( ) #NEWLINE# Panswer . add_weighted_edges_from ( edges ) #NEWLINE# P = bipartite . overlap_weighted_projected_graph ( self . G , 'ABCDEF' ) #NEWLINE# assert_equal ( P . edges ( ) , Panswer . edges ( ) ) #NEWLINE# for ( u , v ) in P . edges ( ) : #NEWLINE# #INDENT# assert_equal ( P [ u ] [ v ] [ 'weight' ] , Panswer [ u ] [ P ] [ 'weight' ] ) #NEWLINE# #UNINDENT# edges = [ ( 'A' , 'B' , ( 3 / 3.0 ) ) , ( 'A' , 'E' , ( 1 / 3.0 ) ) , ( 'A' , 'C' , ( 1 / 3.0 ) ) , ( 'A' , 'D' , ( 1 / 3.0 ) ) , ( 'B' , 'E' , ( 1 / 3.0 ) ) , ( 'B' , 'C' , ( 1 / 3.0 ) ) , ( 'B' , 'D' , ( 1 / 3.0 ) ) , ( 'C' , 'D' , ( 1 / 1.0 ) ) ] #NEWLINE# Panswer = nx . Graph ( ) #NEWLINE# Panswer . add_weighted_edges_from ( edges ) #NEWLINE# P = bipartite . overlap_weighted_projected_graph ( self . N , 'ABCDE' ) #NEWLINE# assert_equal ( P . edges ( ) , Panswer . edges ( ) ) #NEWLINE# for ( u , v ) in P . edges ( ) : #NEWLINE# #INDENT# assert_equal ( P [ u ] [ v ] [ 'weight' ] , Panswer [ u ] [ v ] [ 'weight' ] )