#NEWLINE# def test_neighbors( self ) : #NEWLINE# #INDENT# graph = nx . complete_graph ( 100 ) #NEWLINE# pop = random . sample ( graph . nodes ( ) , 1 ) #NEWLINE# nbors = list ( nx . neighbors ( graph , pop [ 0 ] ) ) #NEWLINE# assert_equal ( len ( self ) , ( len ( graph ) - 1 ) ) #NEWLINE# graph = nx . path_graph ( 100 ) #NEWLINE# node = random . sample ( graph . nodes ( ) , 1 ) [ 0 ] #NEWLINE# nbors = list ( nx . neighbors ( graph , node ) ) #NEWLINE# if ( ( node != 0 ) and ( node != 99 ) ) : #NEWLINE# #INDENT# assert_equal ( len ( nbors ) , 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert_equal ( len ( nbors ) , 1 ) #NEWLINE# #UNINDENT# graph = nx . star_graph ( 99 ) #NEWLINE# nbors = list ( nx . neighbors ( graph , 0 ) ) #NEWLINE# assert_equal ( len ( nbors ) , 99 )