function pagerank_test ( )

%*****************************************************************************80
%
%% pagerank_test() tests pagerank().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 February 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../pagerank' );

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

  for test = 1 : 5
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Test %d\n', test );
    if ( test == 1 )
      label = '5 node MacCormick example with a cycle';
      A = mac1_inc ( );
      filename = 'mac1.png';
    elseif ( test == 2 )
      label = '16 node MacCormick example';
      n = 16;
      A = mac2_inc ( );
      filename = 'mac2.png';
    elseif ( test == 3 )
      label = '6 node Moler example';
      A = moler_inc ( );
      filename = 'moler.png';
    elseif ( test == 4 )
      label = '6 node example';
      A = six_inc ( );
      filename = 'six.png';
    elseif ( test == 5 )
      label = '15 node Sauer example';
      A = sauer_inc ( );
      filename = 'sauer.png';
    end

    fprintf ( 1, '  %s\n', label );
    A
    T = inc_to_transition ( A );
    T
    [ r, s ] = find ( A );
    D = digraph ( r, s );
%
%  Plot the directed graph.
%
    clf ( );
    plot ( D, ...
      'arrowsize', 25, ...
      'linewidth', 2, ...
      'markersize', 10, ...
      'nodefontsize', 16 );
    title ( label );
    print ( '-dpng', filename );
%
%  Compute the rankings.
%
    google_rank ( A );
    power_rank ( A );
    surf_rank ( A );

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pagerank_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../pagerank' );

  return
end
function timestamp ( )

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

  return
end

