function alphabet_binary_tree ( )

%*****************************************************************************80
%
%% alphabet_binary_tree() plots a binary tree for alphabetizing.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 May 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'alphabet_binary_tree():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Plot an alphabetizing binary tree.\n' );
%
%  S is the list of start nodes,
%  T are the terminal nodes.
%
  s = [ ...
     1,  1,  2,  2,  3,  3,  4,  4,  5,  5, ...
     6,  6,  7,  7,  8,  8,  9,  9, 10, 10, ...
    11, 11, 12, 12, 13, 13, 14, 14, 15, 15, ...
    17, 17, 19, 19, 21, 21, 22, 22, 23, 23, ...
    25, 25, 27, 27, 29, 29, 30, 30, 31, 31 ];

  t = [ ...
     2,  3,  4,  5,  6,  7,  8,  9, 10, 11, ...
    12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ...
    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, ...
    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, ...
    42, 43, 44, 45, 46, 47, 48, 49, 50, 51 ];  
%
%  Create a digraph from S and T.
%
  G = digraph ( s, t );
%
%  Set up optional edge and node labels.
%
  nLabels = { ...
    'A-Z', 'A-M', 'N-Z', 'A-F', 'G-M', 'N-S', 'T-Z', 'A-C', 'D-F', 'G-I', ...
    'J-M', 'N-P', 'Q-S', 'T-V', 'W-Z', 'A',   'B-C', 'D',   'E-F', 'G', ...
    'H-I', 'J-K', 'L-M', 'N',   'O-P', 'Q',   'R-S', 'T',   'U-V', 'W-X', ...
    'Y-Z', 'B',   'C',   'E',   'F',   'H',   'I',   'J',   'K',   'L', ...
    'M',   'O',   'P',   'R',   'S',   'U',   'V',   'W',   'X',   'Y', ...
    'Z' };
%
%  Plot the digraph, and specify lots of options.
%
  plot ( G, ...
    'Layout', 'layered', ...
    'NodeLabel', nLabels, ...
    'LineWidth', 2, ...
    'MarkerSize', 10, ...
    'ArrowSize', 5, ...
    'NodeFontSize', 10 );

  title ( 'An alphabetizing binary tree', 'Fontsize', 16 );
%
%  Save a copy.
%
  filename = 'alphabet_binary_tree.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'alphabet_binary_tree():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
 
  return
end

