#NEWLINE# def test_balanced_tree( self ) : #NEWLINE# #INDENT# 'Edge betweenness centrality: balanced tree' #NEWLINE# G = nx . balanced_tree ( r = 2 , h = 2 ) #NEWLINE# b = nx . edge_betweenness_centrality ( G , weight = 'weight' , normalized = False ) #NEWLINE# b_answer = { #NEWLINE# #INDENT# ( 0 , 1 ) : 12 , #NEWLINE# ( 0 , 2 ) : 12 , #NEWLINE# ( 1 , 3 ) : 6 , #NEWLINE# ( 1 , 4 ) : 6 , #NEWLINE# ( 2 , 5 ) : 6 , #NEWLINE# ( 2 , 6 ) : 6 , #NEWLINE# #UNINDENT# } #NEWLINE# for n in sorted ( G . edges ( ) ) : #NEWLINE# #INDENT# assert_almost_equal ( b [ n ] , b_answer [ n ] )