1%BFS_BOOK run BFS on a small graph 2 3% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 4% SPDX-License-Identifier: Apache-2.0 5 6% graph on the cover of the book, 'Graph Algorithms in the language 7% of linear algebra'. The source node is node 4. 8clear 9o = 0 ; 10 11A = [ 12o o o 1 o o o 131 o o o o o o 14o o o 1 o 1 1 151 o o o o o 1 16o 1 o o o o 1 17o o 1 o 1 o o 18o 1 o o o o o ] ; 19 20A = A' ; 21s = 4 ; 22 23v = bfs_test (A, s) ; 24 25vok = [2 3 2 1 4 3 4]' ; 26assert (isequal (v, vok)) ; 27 28% now test all source nodes 29n = size (A, 1) ; 30for s = 1:n 31 fprintf ('\n====================== source: %d\n', s) ; 32 v = bfs_test (A, s) ; 33 v 34end 35 36fprintf ('bfs_book test passed\n') ; 37 38