function single_linkage_test ( )

%*****************************************************************************80
%
%% SINGLE_LINKAGE_TEST demonstrates MATLAB's single linkage functions.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 May 2016
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SINGLE_LINKAGE_TEST\n' );
  fprintf ( 1, '  Demonstrate MATLAB functions for single linkage analysis\n' );
  fprintf ( 1, '  of sets of numeric data, in particular:\n' );
  fprintf ( 1, '  * sv = pdist ( xy ) computes the pairwise distance table\n' );
  fprintf ( 1, '    given a list of point coordinates.\n' ):
  fprintf ( 1, '  * sl linkage ( sv, ''single'' ) computes the single\n' );
  fprintf ( 1, '    linkage information from the distance table.\n' );
  fprintf ( 1, '  * dendrogram ( sl ) displays the single linkage tree.\n' );
%
%  Get a set of (X,Y) coordinates for 13 points from a text file.
%
  xy = load ( 'jb13_xy.txt' );
%
%  Compute the pairwise distance table from the positions.
%
  sv = pdist ( xy );
%
%  Compute the single linkage data from the distance table.
%
  sl = linkage ( sv, 'single' );
%
%  Plot the single linkage data.  
%  Label the data items with the given labels, rather than '1', '2', ...
%
  H = dendrogram ( sl, ...
    'Labels', {'A','B','C','D','E','F','G','H','I','J','K','L','M'}  );
%
%  Request that lines be drawn thicker than the default value of 1.
%
  set ( H, 'linewidth', 2 )
%
%  Save the plot.
%
  filename = 'single_linkage_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Plot saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SINGLE_LINKAGE_TEST\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end

