function graph_dist_min_span_tree2_test ( )

%*****************************************************************************80
%
%% graph_dist_min_span_tree2_test() tests graph_dist_min_span_tree2().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    06 November 2024
%
%  Author:
%
%    John Burkardt
%
  nnode = 5;

  dist = [ ...
       0.0, 100.0, 125.0, 120.0, 110.0; ...
     100.0,   0.0,  40.0,  65.0,  60.0; ...
     125.0,  40.0,   0.0,  45.0,  55.0; ...
     120.0,  65.0,  45.0,   0.0,  50.0; ...
     110.0,  60.0,  55.0,  50.0,   0.0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'graph_dist_min_span_tree2_test():\n' );
  fprintf ( 1, '  graph_dist_min_span_tree() finds a minimum spanning tree.\n' );
  fprintf ( 1, '\n' );
 
  graph_dist_print ( dist, nnode, '  The graph:' );

  [ class, itree, jtree ] = graph_dist_min_span_tree2 ( nnode, dist );
 
  for i = 1 : nnode - 1
    wtree(i) = dist(itree(i),jtree(i));
  end
 
  graph_arc_weight_print ( nnode-1, itree, jtree, wtree, ...
    '  The minimal spanning tree:' );
 
  fprintf ( 1, '\n' );
  fprintf ( 1, '  The length of the minimal tree is %g\n', sum ( wtree ) );
 
  return
end
