#NEWLINE# def test_P3( self ) : #NEWLINE# #INDENT# 'Katz centrality: P3' #NEWLINE# alpha = 0.1 #NEWLINE# G = networkx . path_graph ( 3 ) #NEWLINE# b_answer = { #NEWLINE# #INDENT# 0 : 0.5598852584152165 , #NEWLINE# 1 : 0.6107839182711449 , #NEWLINE# 2 : 0.5598852584152162 , #NEWLINE# #UNINDENT# } #NEWLINE# b = networkx . katz_centrality ( G , alpha ) #NEWLINE# for n in sorted ( G ) : #NEWLINE# #INDENT# assert_almost_equal ( b [ n ] , b_answer [ n ] , places = 4 )