#NEWLINE# def test_communicability_betweenness_centrality( self ) : #NEWLINE# #INDENT# answer = { #NEWLINE# #INDENT# 0 : 0.07017447951484615 , #NEWLINE# 1 : 0.7156559870110799 , #NEWLINE# 2 : 0.7156559870110799 , #NEWLINE# 3 : 0.07017447951484615 , #NEWLINE# #UNINDENT# } #NEWLINE# result = communicability_betweenness_centrality ( nx . path_graph ( 4 ) ) #NEWLINE# for ( k , v ) in result . items ( ) : #NEWLINE# #INDENT# assert_almost_equal ( answer [ k ] , result [ k ] , places = 7 ) #NEWLINE# #UNINDENT# answer1 = { #NEWLINE# #INDENT# '1' : 0.06003907419394952 , #NEWLINE# 'Albert' : 0.315470761661372 , #NEWLINE# 'Aric' : 0.3154707616613721 , #NEWLINE# 'Dan' : 0.682977786783162 , #NEWLINE# 'Franck' : 0.21977926617449497 , #NEWLINE# #UNINDENT# } #NEWLINE# G1 = nx . Graph ( [ ( 'Franck' , 'Aric' ) , ( 'Aric' , 'Dan' ) , ( 'Dan' , 'Albert' ) , ( 'Albert' , 'Franck' ) , ( 'Dan' , '1' ) , ( 'Franck' , 'Albert' ) ] ) #NEWLINE# result1 = communicability_betweenness_centrality ( G1 ) #NEWLINE# for ( k , v ) in result1 . items ( ) : #NEWLINE# #INDENT# assert_almost_equal ( answer1 [ self ] , result1 [ k ] , places = 7 )