function graph_adj_is_nodewise_connected_test ( )

%*****************************************************************************80
%
%% graph_adj_is_nodewise_connected_test() tests graph_adj_is_nodewise_connected().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 August 2022
%
%  Author:
%
%    John Burkardt
%
  A = [ ...
    0, 1, 0, 1, 0, 0, 0, 0, 0; ...
    1, 0, 0, 0, 0, 0, 0, 0, 0; ...
    0, 0, 0, 0, 0, 1, 0, 0, 1; ...
    1, 0, 0, 0, 1, 0, 1, 0, 0; ...
    0, 0, 0, 1, 0, 0, 0, 1, 0; ...
    0, 0, 1, 0, 0, 0, 0, 0, 1; ...
    0, 0, 0, 1, 0, 0, 0, 1, 0; ...
    0, 0, 0, 0, 1, 0, 1, 0, 0; ...
    0, 0, 1, 0, 0, 1, 0, 0, 0 ];

  B = [ ...
    0, 1, 0, 1, 0, 0, 0, 0, 0; ...
    1, 0, 0, 0, 0, 0, 0, 0, 0; ...
    0, 0, 0, 0, 0, 0, 0, 0, 1; ...
    1, 0, 0, 0, 1, 0, 1, 0, 0; ...
    0, 0, 0, 1, 0, 1, 0, 1, 0; ...
    0, 0, 0, 0, 1, 0, 0, 0, 1; ...
    0, 0, 0, 1, 0, 0, 0, 1, 0; ...
    0, 0, 0, 0, 1, 0, 1, 0, 0; ...
    0, 0, 1, 0, 0, 1, 0, 0, 0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'graph_adj_is_nodewise_connected_test( ):\n' );
  fprintf ( 1, '  A graph is to be checked for nodewise connectedness.\n' );
  fprintf ( 1, '  graph_adj_is_nodewise_connected_breadth() uses breadth-first search.\n' );
  fprintf ( 1, '  graph_adj_is_nodewise_connected_depth() uses depth-first search.\n' );
  fprintf ( 1, '  graph_adj_is_nodewise_connected_walks() counts the walks from node to node.\n' );

  acb = graph_adj_is_nodewise_connected_breadth ( A );
  acd = graph_adj_is_nodewise_connected_depth ( A );
  acw = graph_adj_is_nodewise_connected_walks ( A );

  bcb = graph_adj_is_nodewise_connected_breadth ( B );
  bcd = graph_adj_is_nodewise_connected_depth ( B );
  bcw = graph_adj_is_nodewise_connected_walks ( B );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Results for graph A (not connected!)\n');
  fprintf ( 1, '    breadth: %s\n', mat2str ( acb ) );
  fprintf ( 1, '    depth:   %s\n', mat2str ( acd ) );
  fprintf ( 1, '    walks:   %s\n', mat2str ( acw ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Results for graph B (connected!)\n');
  fprintf ( 1, '    breadth: %s\n', mat2str ( bcb ) );
  fprintf ( 1, '    depth:   %s\n', mat2str ( bcd ) );
  fprintf ( 1, '    walks:   %s\n', mat2str ( bcw ) );

  return
end

