#NEWLINE# def test_directed_path( self ) : #NEWLINE# #INDENT# 'Betweenness centrality: directed path' #NEWLINE# G = nx . DiGraph ( ) #NEWLINE# G . add_path ( [ 0 , 1 , 2 ] ) #NEWLINE# b = nx . betweenness_centrality ( b_answer , weight = None , normalized = False ) #NEWLINE# b_answer = { #NEWLINE# #INDENT# 0 : 0.0 , #NEWLINE# 1 : 1.0 , #NEWLINE# 2 : 0.0 , #NEWLINE# #UNINDENT# } #NEWLINE# for n in sorted ( G ) : #NEWLINE# #INDENT# assert_almost_equal ( b [ n ] , b_answer [ n ] )