function test_graph_adj_test ( )

%*****************************************************************************80
%
%% test_graph_adj_test() tests test_graph_adj().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    02 May 2026
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../test_graph_adj' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'test_graph_adj_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test test_graph_adj().\n' );

  graph_adj_print ( 'bush', @graph_adj_bush );
  graph_adj_print ( 'coxeter', @graph_adj_coxeter );
  graph_adj_print ( 'cube', @graph_adj_cube );
  graph_adj_print ( 'diamond', @graph_adj_diamond );
  graph_adj_print ( 'dodecahedron', @graph_adj_dodecahedron );
  m = 4;
  n = 5;
  graph_adj_print ( 'knight', @graph_adj_knight, m, n );
  graph_adj_print ( 'museum', @graph_adj_museum );
  graph_adj_print ( 'octahedron', @graph_adj_octahedron );
  graph_adj_print ( 'petersen', @graph_adj_petersen );
  graph_adj_print ( 'sauer', @graph_adj_sauer );
  graph_adj_print ( 'twig', @graph_adj_twig );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'test_graph_adj_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../test_graph_adj' );

  return
end
function graph_adj_print ( graph_title, graph_adj, varargin )

%*****************************************************************************80
%
%% graph_adj_print() prints the adjacency matrix of a graph.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    26 April 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string graph_title: a title for the graph.
%
%    function graph_adj: a function which returns the arc list of the graph.
%
%    vargin: optional inputs.
%    If only one input, this is the value of m, the number of rows and
%    columns of the knight graph checkerboard.
%    If two inputs, these are the values of m and n, the number of rows and
%    the number of columns of the knight graph checkerboard.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'graph_adj_print():\n' );
  fprintf ( 1, '  Print definition of "%s"\n', graph_title );

  if ( 2 == nargin )
    A = graph_adj ( );
  elseif ( 3 == nargin )
    m = varargin{1};
    A = graph_adj ( m, m );
  elseif ( 4 == nargin )
    m = varargin{1};
    n = varargin{2};
    A = graph_adj ( m, n );
  end

  arc_num = nnz ( A );
  node_num = size ( A, 1 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of nodes = %d\n', node_num );
  fprintf ( 1, '  Number of arcs = %d\n', arc_num );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  adjacency matrix A:\n' );
  disp ( A );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 November 2022
%
%  Author:
%
%    John Burkardt
%
  t = now ( );
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

