function bellman_ford_test01 ( )

%*****************************************************************************80
%
%% BELLMAN_FORD_TEST01 runs a simple test.
%
%  Discussion:
%
%    The correct distances are { 0, -6, -2, 3, 0, 0 }.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    13 November 2014
%
%  Author:
%
%    John Burkardt
%
  e_num = 10;
  v_num = 6;

  e = [ ...
    2, 1; ...
    5, 2; ...
    2, 3; ...
    3, 5; ...
    5, 1; ...
    3, 6; ...
    6, 1; ...
    4, 3; ...
    6, 4; ...
    4, 1 ]';
  e_weight = [ ...
    -3.0; ...
     6.0; ...
    -4.0; ...
    -1.0; ...
     4.0; ...
    -2.0; ...
     2.0; ...
     8.0; ...
    -3.0; ...
     3.0 ]'; 
 
  source = 1;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'BELLMAN_FORD_TEST01:\n' );
  fprintf ( 1, '  Bellman-Ford shortest path algorithm.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of vertices = %d\n', v_num );
  fprintf ( 1, '  Number of edges = %d\n', e_num );
  fprintf ( 1, '  The reference vertex is %d\n', source );

  i4mat_transpose_print ( 2, e_num, e, '  The edge array:' );
  r8vec_print ( e_num, e_weight, '  The edge weights:' );

  [ v_weight, predecessor ] = bellman_ford ( v_num, e_num, source, e, ...
    e_weight );

  r8vec_print ( v_num, v_weight, '  The shortest distances:' );

  i4vec_print ( v_num, predecessor, ...
    '  The vertex predecessor parents for the shortest paths:' );

  return
end
