#NEWLINE# def test_graph_depth_first( ) : #NEWLINE# #INDENT# if ( csgraph_from_dense is None ) : #NEWLINE# #INDENT# raise SkipTest ( "Old version of scipy, doesn't have csgraph." ) #NEWLINE# #UNINDENT# csgraph = np . array ( [ [ 0 , 1 , 2 , 0 , 0 ] , [ 1 , 0 , 0 , 0 , 3 ] , [ 2 , 0 , 0 , 7 , 0 ] , [ 0 , 0 , 7 , 0 , 1 ] , [ 0 , 3 , 0 , 1 , 0 ] ] ) #NEWLINE# csgraph = csgraph_from_dense ( csgraph , null_value = 0 ) #NEWLINE# dfirst = np . array ( [ [ 0 , 1 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 3 ] , [ 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 7 , 0 , 0 ] , [ 0 , 0 , 0 , 1 , 0 ] ] ) #NEWLINE# for directed in [ True , False ] : #NEWLINE# #INDENT# dfirst_test = depth_first_tree ( csgraph , 0 , directed ) #NEWLINE# assert_array_almost_equal ( csgraph_to_dense ( dfirst_test ) , dfirst )