Discriminative Measures \\ {for Comparison of Phylogenetic Trees}
Michael~Shell
~\IEEEmembership{Member,~IEEE,} % John~Doe
~\IEEEmembership{Fellow,~OSA,} % and~Jane~Doe
%% note need leading \protect in front of
to get a newline within \thanks as %%
%\boldmath Efficient and informative comparison of trees is a common essential interest of both computational biology and pattern classification. In this paper, we introduce a novel dissimilarity measure on non-degenerate hierarchies (rooted binary trees), called the NNI navigation distance, that counts the steps along the trajectory of a discrete dynamical system defined over the Nearest Neighbor Interchange(NNI) graph of binary hierarchies. The NNI navigation distance has a unique unifying nature of combining both edge comparison methods and edit operations for comparison of trees and is an efficient approximation to the (NP-hard) NNI distance. It is given by a closed form expression which simply generalizes to nondegenerate hierarchies as well. A ``relaxation'' on the closed form of the NNI navigation distance results a simpler dissimilarity measure on all trees, named the crossing dissimilarity, counts pairwise cluster incompatibilities of trees. Both of our dissimilarity measures on nondegenerate hierarchies are positive definite (vanishes only between identical trees) and symmetric but are not a true metric because they do not satisfy the triangle inequality. Although they are not true metrics, they are both linearly bounded below by the widely used Robinson-Foulds metric and above by a new tree metric, called the cluster-cardinality distance --- the pullback metric of a matrix norm along an embedding of hierarchies into the space of matrices. All of these proposed tree measures can be efficiently computed in time $O(n^2)$ in the number of leaves, $n$.
body_outline.tex

%% bare_jrnl_compsoc.tex
%% V1.3
%% 2007/01/11
%% by Michael Shell
%% See:
%% http://www.michaelshell.org/
%% for current contact information.
%%
%% This is a skeleton file demonstrating the use of IEEEtran.cls
%% (requires IEEEtran.cls version 1.7 or later) with an IEEE Computer
%% Society journal paper.
%%
%% Support sites:
%% http://www.michaelshell.org/tex/ieeetran/
%% http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran/
%% and
%% http://www.ieee.org/

%%*************************************************************************
%% Legal Notice:
%% This code is offered as-is without any warranty either expressed or
%% implied; without even the implied warranty of MERCHANTABILITY or
%% FITNESS FOR A PARTICULAR PURPOSE! 
%% User assumes all risk.
%% In no event shall IEEE or any contributor to this code be liable for
%% any damages or losses, including, but not limited to, incidental,
%% consequential, or any other damages, resulting from the use or misuse
%% of any information contained here.
%%
%% All comments are the opinions of their respective authors and are not
%% necessarily endorsed by the IEEE.
%%
%% This work is distributed under the LaTeX Project Public License (LPPL)
%% ( http://www.latex-project.org/ ) version 1.3, and may be freely used,
%% distributed and modified. A copy of the LPPL, version 1.3, is included
%% in the base LaTeX documentation of all distributions of LaTeX released
%% 2003/12/01 or later.
%% Retain all contribution notices and credits.
%% ** Modified files should be clearly indicated as such, including  **
%% ** renaming them and changing author support contact information. **
%%
%% File list of work: IEEEtran.cls, IEEEtran_HOWTO.pdf, bare_adv.tex,
%%                    bare_conf.tex, bare_jrnl.tex, bare_jrnl_compsoc.tex
%%*************************************************************************

% *** Authors should verify (and, if needed, correct) their LaTeX system  ***
% *** with the testflow diagnostic prior to trusting their LaTeX platform ***
% *** with production work. IEEE's font choices can trigger bugs that do  ***
% *** not appear when using other class files.                            ***
% The testflow support page is at:
% http://www.michaelshell.org/tex/testflow/




% Note that the a4paper option is mainly intended so that authors in
% countries using A4 can easily print to A4 and see how their papers will
% look in print - the typesetting of the document will not typically be
% affected with changes in paper size (but the bottom and side margins will).
% Use the testflow package mentioned above to verify correct handling of
% both paper sizes by the user's LaTeX system.
%
% Also note that the "draftcls" or "draftclsnofoot", not "draft", option
% should be used if it is desired that the figures are to be displayed in
% draft mode.
%
% The Computer Society usually requires 10pt for submissions.
%
\documentclass[10pt,journal,cspaper,compsoc]{IEEEtran}
%
% If IEEEtran.cls has not been installed into the LaTeX system files,
% manually specify the path to it like:
% \documentclass[12pt,journal,compsoc]{../sty/IEEEtran}





% Some very useful LaTeX packages include:
% (uncomment the ones you want to load)


% *** MISC UTILITY PACKAGES ***
%
%\usepackage{ifpdf}
% Heiko Oberdiek's ifpdf.sty is very useful if you need conditional
% compilation based on whether the output is pdf or dvi.
% usage:
% \ifpdf
%   % pdf code
% \else
%   % dvi code
% \fi
% The latest version of ifpdf.sty can be obtained from:
% http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/
% Also, note that IEEEtran.cls V1.7 and later provides a builtin
% \ifCLASSINFOpdf conditional that works the same way.
% When switching from latex to pdflatex and vice-versa, the compiler may
% have to be run twice to clear warning/error messages.






% *** CITATION PACKAGES ***
%
\ifCLASSOPTIONcompsoc
  % IEEE Computer Society needs nocompress option
  % requires cite.sty v4.0 or later (November 2003)
  %\usepackage[nocompress]{cite}
  %ToDo - Omur here solve the problem with citations
\else
  % normal IEEE
  % \usepackage{cite}
\fi
% cite.sty was written by Donald Arseneau
% V1.6 and later of IEEEtran pre-defines the format of the cite.sty package
% \cite{} output to follow that of IEEE. Loading the cite package will
% result in citation numbers being automatically sorted and properly
% "compressed/ranged". e.g., [1], [9], [2], [7], [5], [6] without using
% cite.sty will become [1], [2], [5]--[7], [9] using cite.sty. cite.sty's
% \cite will automatically add leading space, if needed. Use cite.sty's
% noadjust option (cite.sty V3.8 and later) if you want to turn this off.
% cite.sty is already installed on most LaTeX systems. Be sure and use
% version 4.0 (2003-05-27) and later if using hyperref.sty. cite.sty does
% not currently provide for hyperlinked citations.
% The latest version can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/cite/
% The documentation is contained in the cite.sty file itself.
%
% Note that some packages require special options to format as the Computer
% Society requires. In particular, Computer Society  papers do not use
% compressed citation ranges as is done in typical IEEE papers
% (e.g., [1]-[4]). Instead, they list every citation separately in order
% (e.g., [1], [2], [3], [4]). To get the latter we need to load the cite
% package with the nocompress option which is supported by cite.sty v4.0
% and later. Note also the use of a CLASSOPTION conditional provided by
% IEEEtran.cls V1.7 and later.





% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
  % \usepackage[pdftex]{graphicx}
  % declare the path(s) where your graphic files are
  % \graphicspath{{../pdf/}{../jpeg/}}
  % and their extensions so you won't have to specify these with
  % every instance of \includegraphics
  % \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
  % or other class option (dvipsone, dvipdf, if not using dvips). graphicx
  % will default to the driver specified in the system graphics.cfg if no
  % driver is specified.
  % \usepackage[dvips]{graphicx}
  % declare the path(s) where your graphic files are
  % \graphicspath{{../eps/}}
  % and their extensions so you won't have to specify these with
  % every instance of \includegraphics
  % \DeclareGraphicsExtensions{.eps}
\fi
% graphicx was written by David Carlisle and Sebastian Rahtz. It is
% required if you want graphics, photos, etc. graphicx.sty is already
% installed on most LaTeX systems. The latest version and documentation can
% be obtained at: 
% http://www.ctan.org/tex-archive/macros/latex/required/graphics/
% Another good source of documentation is "Using Imported Graphics in
% LaTeX2e" by Keith Reckdahl which can be found as epslatex.ps or
% epslatex.pdf at: http://www.ctan.org/tex-archive/info/
%
% latex, and pdflatex in dvi mode, support graphics in encapsulated
% postscript (.eps) format. pdflatex in pdf mode supports graphics
% in .pdf, .jpeg, .png and .mps (metapost) formats. Users should ensure
% that all non-photo figures use a vector format (.eps, .pdf, .mps) and
% not a bitmapped formats (.jpeg, .png). IEEE frowns on bitmapped formats
% which can result in "jaggedy"/blurry rendering of lines and letters as
% well as large increases in file sizes.
%
% You can find documentation about the pdfTeX application at:
% http://www.tug.org/applications/pdftex





% *** MATH PACKAGES ***
%
%\usepackage[cmex10]{amsmath}
% A popular package from the American Mathematical Society that provides
% many useful and powerful commands for dealing with mathematics. If using
% it, be sure to load this package with the cmex10 option to ensure that
% only type 1 fonts will utilized at all point sizes. Without this option,
% it is possible that some math symbols, particularly those within
% footnotes, will be rendered in bitmap form which will result in a
% document that can not be IEEE Xplore compliant!
%
% Also, note that the amsmath package sets \interdisplaylinepenalty to 10000
% thus preventing page breaks from occurring within multiline equations. Use:
%\interdisplaylinepenalty=2500
% after loading amsmath to restore such page breaks as IEEEtran.cls normally
% does. amsmath.sty is already installed on most LaTeX systems. The latest
% version and documentation can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/





% *** SPECIALIZED LIST PACKAGES ***
%
%\usepackage{algorithmic}
% algorithmic.sty was written by Peter Williams and Rogerio Brito.
% This package provides an algorithmic environment fo describing algorithms.
% You can use the algorithmic environment in-text or within a figure
% environment to provide for a floating algorithm. Do NOT use the algorithm
% floating environment provided by algorithm.sty (by the same authors) or
% algorithm2e.sty (by Christophe Fiorio) as IEEE does not use dedicated
% algorithm float types and packages that provide these will not provide
% correct IEEE style captions. The latest version and documentation of
% algorithmic.sty can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/algorithms/
% There is also a support site at:
% http://algorithms.berlios.de/index.html
% Also of interest may be the (relatively newer and more customizable)
% algorithmicx.sty package by Szasz Janos:
% http://www.ctan.org/tex-archive/macros/latex/contrib/algorithmicx/




% *** ALIGNMENT PACKAGES ***
%
%\usepackage{array}
% Frank Mittelbach's and David Carlisle's array.sty patches and improves
% the standard LaTeX2e array and tabular environments to provide better
% appearance and additional user controls. As the default LaTeX2e table
% generation code is lacking to the point of almost being broken with
% respect to the quality of the end results, all users are strongly
% advised to use an enhanced (at the very least that provided by array.sty)
% set of table tools. array.sty is already installed on most systems. The
% latest version and documentation can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/required/tools/


%\usepackage{mdwmath}
%\usepackage{mdwtab}
% Also highly recommended is Mark Wooding's extremely powerful MDW tools,
% especially mdwmath.sty and mdwtab.sty which are used to format equations
% and tables, respectively. The MDWtools set is already installed on most
% LaTeX systems. The lastest version and documentation is available at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/mdwtools/


% IEEEtran contains the IEEEeqnarray family of commands that can be used to
% generate multiline equations as well as matrices, tables, etc., of high
% quality.


%\usepackage{eqparbox}
% Also of notable interest is Scott Pakin's eqparbox package for creating
% (automatically sized) equal width boxes - aka "natural width parboxes".
% Available at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/eqparbox/





% *** SUBFIGURE PACKAGES ***
%\ifCLASSOPTIONcompsoc
%\usepackage[tight,normalsize,sf,SF]{subfigure}
%\else
%\usepackage[tight,footnotesize]{subfigure}
%\fi
% subfigure.sty was written by Steven Douglas Cochran. This package makes it
% easy to put subfigures in your figures. e.g., "Figure 1a and 1b". For IEEE
% work, it is a good idea to load it with the tight package option to reduce
% the amount of white space around the subfigures. Computer Society papers
% use a larger font and \sffamily font for their captions, hence the
% additional options needed under compsoc mode. subfigure.sty is already
% installed on most LaTeX systems. The latest version and documentation can
% be obtained at:
% http://www.ctan.org/tex-archive/obsolete/macros/latex/contrib/subfigure/
% subfigure.sty has been superceeded by subfig.sty.


%\ifCLASSOPTIONcompsoc
%  \usepackage[caption=false]{caption}
%  \usepackage[font=normalsize,labelfont=sf,textfont=sf]{subfig}
%\else
%  \usepackage[caption=false]{caption}
%  \usepackage[font=footnotesize]{subfig}
%\fi
% subfig.sty, also written by Steven Douglas Cochran, is the modern
% replacement for subfigure.sty. However, subfig.sty requires and
% automatically loads Axel Sommerfeldt's caption.sty which will override
% IEEEtran.cls handling of captions and this will result in nonIEEE style
% figure/table captions. To prevent this problem, be sure and preload
% caption.sty with its "caption=false" package option. This is will preserve
% IEEEtran.cls handing of captions. Version 1.3 (2005/06/28) and later 
% (recommended due to many improvements over 1.2) of subfig.sty supports
% the caption=false option directly:
%\ifCLASSOPTIONcompsoc
%  \usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
%\else
%  \usepackage[caption=false,font=footnotesize]{subfig}
%\fi
%
% The latest version and documentation can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/subfig/
% The latest version and documentation of caption.sty can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/caption/




% *** FLOAT PACKAGES ***
%
%\usepackage{fixltx2e}
% fixltx2e, the successor to the earlier fix2col.sty, was written by
% Frank Mittelbach and David Carlisle. This package corrects a few problems
% in the LaTeX2e kernel, the most notable of which is that in current
% LaTeX2e releases, the ordering of single and double column floats is not
% guaranteed to be preserved. Thus, an unpatched LaTeX2e can allow a
% single column figure to be placed prior to an earlier double column
% figure. The latest version and documentation can be found at:
% http://www.ctan.org/tex-archive/macros/latex/base/



%\usepackage{stfloats}
% stfloats.sty was written by Sigitas Tolusis. This package gives LaTeX2e
% the ability to do double column floats at the bottom of the page as well
% as the top. (e.g., "\begin{figure*}[!b]" is not normally possible in
% LaTeX2e). It also provides a command:
%\fnbelowfloat
% to enable the placement of footnotes below bottom floats (the standard
% LaTeX2e kernel puts them above bottom floats). This is an invasive package
% which rewrites many portions of the LaTeX2e float routines. It may not work
% with other packages that modify the LaTeX2e float routines. The latest
% version and documentation can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/sttools/
% Documentation is contained in the stfloats.sty comments as well as in the
% presfull.pdf file. Do not use the stfloats baselinefloat ability as IEEE
% does not allow \baselineskip to stretch. Authors submitting work to the
% IEEE should note that IEEE rarely uses double column equations and
% that authors should try to avoid such use. Do not be tempted to use the
% cuted.sty or midfloat.sty packages (also by Sigitas Tolusis) as IEEE does
% not format its papers in such ways.




%\ifCLASSOPTIONcaptionsoff
%  \usepackage[nomarkers]{endfloat}
% \let\MYoriglatexcaption\caption
% \renewcommand{\caption}[2][\relax]{\MYoriglatexcaption[#2]{#2}}
%\fi
% endfloat.sty was written by James Darrell McCauley and Jeff Goldberg.
% This package may be useful when used in conjunction with IEEEtran.cls'
% captionsoff option. Some IEEE journals/societies require that submissions
% have lists of figures/tables at the end of the paper and that
% figures/tables without any captions are placed on a page by themselves at
% the end of the document. If needed, the draftcls IEEEtran class option or
% \CLASSINPUTbaselinestretch interface can be used to increase the line
% spacing as well. Be sure and use the nomarkers option of endfloat to
% prevent endfloat from "marking" where the figures would have been placed
% in the text. The two hack lines of code above are a slight modification of
% that suggested by in the endfloat docs (section 8.3.1) to ensure that
% the full captions always appear in the list of figures/tables - even if
% the user used the short optional argument of \caption[]{}.
% IEEE papers do not typically make use of \caption[]'s optional argument,
% so this should not be an issue. A similar trick can be used to disable
% captions of packages such as subfig.sty that lack options to turn off
% the subcaptions:
% For subfig.sty:
% \let\MYorigsubfloat\subfloat
% \renewcommand{\subfloat}[2][\relax]{\MYorigsubfloat[]{#2}}
% For subfigure.sty:
% \let\MYorigsubfigure\subfigure
% \renewcommand{\subfigure}[2][\relax]{\MYorigsubfigure[]{#2}}
% However, the above trick will not work if both optional arguments of
% the \subfloat/subfig command are used. Furthermore, there needs to be a
% description of each subfigure *somewhere* and endfloat does not add
% subfigure captions to its list of figures. Thus, the best approach is to
% avoid the use of subfigure captions (many IEEE journals avoid them anyway)
% and instead reference/explain all the subfigures within the main caption.
% The latest version of endfloat.sty and its documentation can obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/endfloat/
%
% The IEEEtran \ifCLASSOPTIONcaptionsoff conditional can also be used
% later in the document, say, to conditionally put the References on a 
% page by themselves.




% *** PDF, URL AND HYPERLINK PACKAGES ***
%
%\usepackage{url}
% url.sty was written by Donald Arseneau. It provides better support for
% handling and breaking URLs. url.sty is already installed on most LaTeX
% systems. The latest version can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/misc/
% Read the url.sty source comments for usage information. Basically,
% \url{my_url_here}.





% *** Do not adjust lengths that control margins, column widths, etc. ***
% *** Do not use packages that alter fonts (such as pslatex).         ***
% There should be no need to do such things with IEEEtran.cls V1.6 and later.
% (Unless specifically asked to do so by the journal or conference you plan
% to submit to, of course. )


\usepackage{bbm} % for indicator function
\usepackage[%
hyperfigures=true,%
backref=page,%
pagebackref=true,%
breaklinks=true,%
colorlinks=true,%
citecolor=green,%
linkcolor=blue%
]{hyperref}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{pifont}
%\usepackage{mathrsfs}
\usepackage{graphicx, subfigure, epsf, latexsym, psfrag, bm}
\usepackage{graphics, array}
\usepackage{epsfig}
%\usepackage{amscd}
\usepackage{latexsym}
\usepackage[mathcal]{euscript}
%\usepackage{young}
\usepackage[vcentermath]{youngtab}
\usepackage{multirow}
%\usepackage[mathscr]{eucal}

\usepackage{theorem}
\usepackage{citesort}
\usepackage{color}
\usepackage{pstricks}
\usepackage{cite}
%\usepackage{hyperref}
\usepackage{multirow}
%\usepackage{appendix}
\usepackage{comment}
% \usepackage{dsfont}
%
%\usepackage{fullpage}
%\pagestyle{myheadings}
%%\markboth{%Base Technical Report 
%%Draft  of \today: please do not circulate!}
%%          {%Base Technical Report 
%%Draft  of \today: please do not circulate!}


% correct bad hyphenation here
\hyphenation{op-tical net-works semi-conduc-tor}

\input{header}
\input{notation}


\begin{document}
%
% paper title
% can use linebreaks \\ within to get better formatting as desired
\title{Discriminative Measures \\ 
\huge{for Comparison of Phylogenetic Trees}}
%
%
% author names and IEEE memberships
% note positions of commas and nonbreaking spaces ( ~ ) LaTeX will not break
% a structure at a ~ so this keeps an author's name from being broken across
% two lines.
% use \thanks{} to gain access to the first footnote area
% a separate \thanks must be used for each paragraph as LaTeX2e's \thanks
% was not built to handle multiple paragraphs
%
%
%\IEEEcompsocitemizethanks is a special \thanks that produces the bulleted
% lists the Computer Society journals use for "first footnote" author
% affiliations. Use \IEEEcompsocthanksitem which works much like \item
% for each affiliation group. When not in compsoc mode,
% \IEEEcompsocitemizethanks becomes like \thanks and
% \IEEEcompsocthanksitem becomes a line break with idention. This
% facilitates dual compilation, although admittedly the differences in the
% desired content of \author between the different types of papers makes a
% one-size-fits-all approach a daunting prospect. For instance, compsoc 
% journal papers have the author affiliations above the "Manuscript
% received ..."  text while in non-compsoc journals this is reversed. Sigh.

%\author{Michael~Shell,~\IEEEmembership{Member,~IEEE,}
%        John~Doe,~\IEEEmembership{Fellow,~OSA,}
%        and~Jane~Doe,~\IEEEmembership{Life~Fellow,~IEEE}% <-this % stops a space
%\IEEEcompsocitemizethanks{\IEEEcompsocthanksitem M. Shell is with the Department
%of Electrical and Computer Engineering, Georgia Institute of Technology, Atlanta,
%GA, 30332.\protect\\
%% note need leading \protect in front of \\ to get a newline within \thanks as
%% \\ is fragile and will error, could use \hfil\break instead.
%E-mail: see http://www.michaelshell.org/contact.html
%\IEEEcompsocthanksitem J. Doe and J. Doe are with Anonymous University.}% <-this % stops a space
%\thanks{}}

\author{Omur Arslan$^{*}$, Dan P. Guralnik$^{*}$  and Daniel E. Koditschek$^{*}$% <-this % stops a space
%\thanks{*This work was not supported by any organization}% <-this % stops a space
\thanks{$^{*}$ Department of Electrical and Systems Engineering, University of
Pennsylvania, Philadelphia, PA 19104}
\thanks{
This work was funded in part by the Air Force Office of Science
Research under the MURI FA9550-10-1-0567.
}}

% note the % following the last \IEEEmembership and also \thanks - 
% these prevent an unwanted space from occurring between the last author name
% and the end of the author line. i.e., if you had this:
% 
% \author{....lastname \thanks{...} \thanks{...} }
%                     ^------------^------------^----Do not want these spaces!
%
% a space would be appended to the last name and could cause every name on that
% line to be shifted left slightly. This is one of those "LaTeX things". For
% instance, "\textbf{A} \textbf{B}" will typeset as "A B" not "AB". To get
% "AB" then you have to do: "\textbf{A}\textbf{B}"
% \thanks is no different in this regard, so shield the last } of each \thanks
% that ends a line with a % and do not let a space in before the next \thanks.
% Spaces after \IEEEmembership other than the last one are OK (and needed) as
% you are supposed to have spaces between the names. For what it is worth,
% this is a minor point as most people would not even notice if the said evil
% space somehow managed to creep in.



% The paper headers
%\markboth{ESE Technical Report - \today}%{Journal of \LaTeX\ Class Files,~Vol.~?, No.~?, Apr~2013}%
%{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Computer Society Journals}
% The only time the second header will appear is for the odd numbered pages
% after the title page when using the twoside option.
% 
% *** Note that you probably will NOT want to include the author's ***
% *** name in the headers of peer review papers.                   ***
% You can use \ifCLASSOPTIONpeerreview for conditional compilation here if
% you desire.



% The publisher's ID mark at the bottom of the page is less important with
% Computer Society journal papers as those publications place the marks
% outside of the main text columns and, therefore, unlike regular IEEE
% journals, the available text space is not reduced by their presence.
% If you want to put a publisher's ID mark on the page you can do it like
% this:
%\IEEEpubid{0000--0000/00\$00.00~\copyright~2007 IEEE}
% or like this to get the Computer Society new two part style.
%\IEEEpubid{\makebox[\columnwidth]{\hfill 0000--0000/00/\$00.00~\copyright~2007 IEEE}%
%\hspace{\columnsep}\makebox[\columnwidth]{Published by the IEEE Computer Society\hfill}}
% Remember, if you use this you must call \IEEEpubidadjcol in the second
% column for its text to clear the IEEEpubid mark (Computer Society jorunal
% papers don't need this extra clearance.)




% for Computer Society papers, we must declare the abstract and index terms
% PRIOR to the title within the \IEEEcompsoctitleabstractindextext IEEEtran
% command as these need to go into the title area created by \maketitle.
\IEEEcompsoctitleabstractindextext{%
\begin{abstract}
%\boldmath

Efficient and informative comparison of trees is a common essential interest of both computational biology and pattern classification.
In this paper, we introduce a novel dissimilarity measure on non-degenerate hierarchies (rooted binary trees), called \emph{the NNI navigation distance}, that counts the steps along  the trajectory of a discrete dynamical system defined over the Nearest Neighbor Interchange(NNI) graph of binary hierarchies. 
The NNI navigation distance has a unique unifying nature of combining both edge comparison methods and edit operations for comparison of trees and is an efficient approximation to the (NP-hard) NNI distance.
It is given by a closed form expression which simply generalizes to nondegenerate hierarchies as well.
A ``relaxation'' on the closed form of the NNI navigation distance results a simpler dissimilarity measure on all trees, named \emph{the crossing dissimilarity}, counts pairwise cluster incompatibilities of trees.
Both of our dissimilarity measures on nondegenerate hierarchies  are positive definite (vanishes only between identical trees) and symmetric but are not a true metric because they do not satisfy the triangle inequality. 
Although they are not true metrics, they are both linearly bounded below by the widely used Robinson-Foulds metric and  above by a new tree metric,  called \emph{the cluster-cardinality} distance --- the pullback metric of a matrix norm along an embedding of hierarchies into the space of  matrices.
All of these proposed tree measures can be efficiently computed   in time $O(n^2)$ in the number of leaves, $n$.  
\end{abstract}
% IEEEtran.cls defaults to using nonbold math in the Abstract.
% This preserves the distinction between vectors and scalars. However,
% if the journal you are submitting to favors bold math in the abstract,
% then you can use LaTeX's standard command \boldmath at the very start
% of the abstract to achieve this. Many IEEE journals frown on math
% in the abstract anyway. In particular, the Computer Society does
% not want either math or citations to appear in the abstract.

% Note that keywords are not normally used for peer review papers.
\begin{keywords}
Evolutionary trees, Nearest Neighbor Interchange, Comparison of Classifications, Tree Space, Tree Metric, Robinson-Foulds Distance, Consensus Tree, Median Tree, Rotation Distance, Diagonal-Flip Distance.
\end{keywords}}


% make the title area
\maketitle


% To allow for easy dual compilation without having to reenter the
% abstract/keywords data, the \IEEEcompsoctitleabstractindextext text will
% not be used in maketitle, but will appear (i.e., to be "transported")
% here as \IEEEdisplaynotcompsoctitleabstractindextext when compsoc mode
% is not selected <OR> if conference mode is selected - because compsoc
% conference papers position the abstract like regular (non-compsoc)
% papers do!
\IEEEdisplaynotcompsoctitleabstractindextext
% \IEEEdisplaynotcompsoctitleabstractindextext has no effect when using
% compsoc under a non-conference mode.


% For peer review papers, you can put extra information on the cover
% page as needed:
% \ifCLASSOPTIONpeerreview
% \begin{center} \bfseries EDICS Category: 3-BBND \end{center}
% \fi
%
% For peerreview papers, this IEEEtran command inserts a page break and
% creates the second title. It will be ignored for other modes.
\IEEEpeerreviewmaketitle


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\label{sec.Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 
A fundamental classification problem common to both
computational biology and engineering 
is the efficient and informative comparison of hierarchical structures.
Typically, in bioinformatics settings, these take the form of phylogenetic
trees representing evolutionary relationships within  a set of
taxa. Typically, in pattern recognition or data mining settings,  hierarchical trees encode nested sequences of
groupings of a set of observations. 
Dissimilarity between combinatorial trees has been computed in the past literature largely by recourse to one of two approaches: either comparing
edges or counting edit distances.  
Representing the former approach, a widely used tree metric is the Robinson-Foulds (RF) or symmetric difference distance, $\distRF$, \cite{robinson_foulds_mb1981} whose count of the disparate edges between trees requires linear time, $\bigO{n}$, in the number of leaves, $n$, to compute \cite{day_joc1985}.
Empirically,  $\distRF$ offers only a very coarse measure of disparity, and among its many proposed refinements, the recent matching split distance $\distMS$, \cite{bogdanowicz_giaro_TCBB2012, lin_rajan_moret_TCBB2012} offers a more discriminative
metric albeit with considerably higher computational cost, $\bigO{n^{2.5} \log n}$.
Alternatively, various edit distances have been proposed \cite{robinson_jct1971, moore_goodman_barnabas_jtb1973, allen_steel_AC2001, felsenstein2004} but the most natural variant, the Nearest Neighbor Interchange (NNI) distance $\dist_{NNI}$, entails an NP-complete computation for both labelled and unlabelled trees \cite{DasguptaEtAL_DIMACS1997}.  



In this paper we introduce a new dissimilarity measure on nondegenerate hierarchies, 
the  \emph{ NNI navigation distance}  $\dist_{Nav}$,  
that can be computed in time $O(n^2)$ for trees with
$n$ leaves.  
Although $\dist_{Nav}$ is positive definite (vanishes only between identical trees) and symmetric, 
it is not a true metric because it does not satisfy the triangle inequality. 
We provide tight bounds by showing it is at least linear and at most quadratic,
\begin{align}
 \distRF \leq \dist_{Nav} \leq  \frac{1}{2}\distRF^2 + \frac{1}{2} \distRF ,
\end{align}
%
with respect to the Robinson-Foulds distance. 
Our measure, a closed form expression comprising a weighted count of special incompatible clusters of two trees, is derived as a kind of discrete  "path integral". 
Namely, it counts the steps along the trajectory of a discrete
dynamical system defined over the NNI-graph of tree
space that seeks to reduce the number of incompatible
clusters level by level at each chosen NNI operation.
In this sense, $\dist_{Nav}$ seems distinguished in the large and still rapidly growing tree distance literature by offering a compromise between the two traditional approaches. 
On the one hand,  $\dist_{Nav}$ heuristically (but efficiently) approximates $\dist_{NNI}$, while on the other, it is designed to be sensitive to the edge  (i.e. tree clusters - as opposed to NNI-graph edges) properties as well.


We find it useful to introduce a ``relaxation'' of $\dist_{Nav}$  yielding a simpler dissimilarity measure, the crossing dissimilarity $\distCM$. 
This function simply counts all the pairwise cluster incompatibilities between two trees, hence it  still incurs a $\bigO{n^2}$ computational cost. 
Like $\dist_{Nav}$, $\dist_{CM}$ is a positive definite, symmetric function of
nondegenerate trees whose failure to respect the triangle inequality is mitigated by tight upper (quadratic) and lower (linear) bounds respecting $\distRF$,
%
\begin{align}
\distRF \leq \dist_{CM} \leq \distRF^2.
\end{align}
%
Because of their close relationship, $\dist_{CM}$ defines a linear bound on $\dist_{Nav}$,
%
\begin{align}
\dist_{Nav} \leq \frac{3}{2} \dist_{CM}.
\end{align}
%


But unlike $\dist_{Nav}$, $\dist_{CM}$ is simple enough to work with that it can be linearly bounded from above by a true metric. 
Namely, we introduce yet a new tree metric, \emph{the cluster cardinality distance}, $\distCC$, --- the pullback of a matrix norm along an embedding of hierarchies into the space of matrices, which is computable in $\bigO{n^2}$ time. 
Thus, although neither $\dist_{Nav}$ nor $\dist_{CM}$ are true metrics, in addition to the  RF bounds just stated, they can also  be linearly bounded  above by  $\distCC$,
%
\begin{align} \label{eq.TreeMeasureOrder}
\frac{2}{3}\distRF\leq \frac{2}{3}\dist_{Nav} \leq \dist_{CM} \leq \distCC.
\end{align}
%






We have mentioned some of the new features of our tree proximity measures that might hold interest for pattern classification and phylogeny analysis  relative to the diverse alternatives that have appeared in the literature.  
Closest among these many alternatives\cite{li_tromp_zhang_jtb1996, culik_wood_IPL1982, brown_day_JOC1984}, $\dist_{Nav}$ has some resemblance to an early NNI graph navigation  algorithm, $\dist_{ra}$ \cite{brown_day_JOC1984} which used a divide-and-conquer approach with a balancing strategy to achieve an $\bigO{n \log n}$ computation of tree dissimilarity.
Notwithstanding  its lower computational cost, in contrast to  $\dist_{Nav}$, the recursive definition of $\dist_{ra}$, as with many NNI distance approximations\cite{li_tromp_zhang_jtb1996, culik_wood_IPL1982, brown_day_JOC1984}, does not admit of a  closed form expression (and, likely in consequence, enjoys no reported metric upper bound).
%
Perhaps more significantly for potential applications, $\dist_{Nav}$ and our related measures  are, like $\distMS$ \cite{bogdanowicz_giaro_TCBB2012},   sensitive to the tree depth at which disparity occurs. 
In the definition of  $\dist_{Nav}$ edges closer to the root have greater influence on the total cost. 
As pointed out in \cite{bogdanowicz_giaro_TCBB2012}, this  is intuitively consistent with many agglomerative
hierarchical clustering and distance-based phylogenetic
reconstruction methods whose "bottom-up" nature
generally implies that  cluster merging cost, a measure of cluster dissimilarity, increases
at each iteration towards the root.




It is often of interest to compare more than pairs of hierarchies at a time, and the notion of a "consensus" tree has accordingly claimed a good deal of attention in the literature  \cite{bryant_DIMACS2003}. 
%In particular,  a geometric median tree  minimizing the sum of distances to trees respecting a certain metric  provides a statistics on the central tendency of trees, but it is generally computationally costly to obtain. 
For instance, the majority rule tree \cite{margush_mcmorris_BMB1981} of a set of  trees is a median tree respecting the RF distance and provides statistics on the central tendency of trees \cite{barthelemy_mcmorris_JC1986}.
When $\dist_{Nav}$ and $\dist_{CM}$ are extended to degenerate trees they fail to be positive definite, and thus their behavior over (typically degenerate) consensus trees departs still further from the properties of a true metric. However, it turns out that 
both strict \cite{rohlf_MB1982}  and loose (semi-strict) \cite{bremer_C1990} consensus trees behave as median trees with respect to both our dissimilarities. 
In fact, the loose consensus tree is the maximal (finest) median tree for both $\dist_{Nav}$ and $\dist_{CM}$.  
%


A final observation of significant  interest in some application settings   is that the computation  of $\dist_{Nav}$  derives from an exact path in tree space that can be explicitly computed with the same $O(n^2)$ computational cost.
Such paths are motivated by independent problems related to particle swarm coordination \cite{arslanEtAl_Allerton2012, ayanian_kumar_koditschek_RR2011} , but may likely hold value for researchers interested in tree consensus and averaging  as well.

%  $\dist_{Nav}$ has a  ”monotone”
%relationship to $\distRF$, $\dist_{CM}$ and  $\distCC$  in the sense that
%their  measures of dissimilarity respecting  a desired
%hierarchy $\tau^*$,   are all non-increasing (in fact, strictly decreasing,
%for a suitably weighted version of $\dist_{CM}$) along any of the equal length NNI navigation trajectories  that define $\dist_{Nav}$.


%The rest of the paper is organized as follows.
%\refsec{sec.BackgroundNotation} introduces the notation used throughout the sequel and gives a concise summary of related tree metrics. 
%\refsec{sec.EdgeComparison} introduces two new tree measures based on discriminative comparison of edges: 
%the cluster-crossing distance $\distCC$ --- the pullback metric of a matrix norm along an embedding of trees into the space of matrices,  and the crossing dissimilarity $\distCM$ --- the count of pairwise incompatible clusters of trees.
%\refsec{sec.NavTreeSpace} presents  the NNI navigation dissimilarity $\dist_{Nav}$ --- a kind of discrete path integral along the trajectory of an abstract discrete dynamical system  in the space of trees.
%In addition to  the relation between commonly used consensus models  and our tree dissimilarities $\distCM$ and $\distNav$ \refsec{sec:Discussion} demonstrates the empirical  distributions of several trees metrics.
%We conclude with a brief discussion of future directions in \refsec{sec.Conclusion}.      
    



 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Background \& Notation}
\label{sec.BackgroundNotation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

We now introduce our basic notation used throughout
the paper and recall several standard notions of hierarchies,
such as cluster compatibility, hierarchical relations
of clusters and tree operations, from a set theoretical perspective.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Hierarchies}
\label{sec.Hierarchies}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A hierarchy $\tree$ over a fixed finite index set $\indexset$, say $\indexset = \brl{n} \ldf \crl{1,2, \ldots, n}$, uniquely determines (and henceforth will be interchangeably identified with) a rooted semi-labelled tree :
a directed acyclic graph $G_{\tree} = \prl{V_{\tree}, E_{\tree}}$, 
whose leaves, vertices of degree one, are  bijectively labelled by  $\indexset$ and interior vertices  have out-degree at least two, and  all the edges in  $E_{\tree}$ are directed away from a vertex, designated to be the \emph{root}, with the property that all of its other vertices are reachable from the root through a directed path in $\tree$ \cite{billera_holmes_vogtmann_aap2001}.
The \emph{cluster} $\cluster{v}$ of a vertex $v \in V_{\tree}$ is defined to be the set of  leaves reachable from  $v$ by a directed path in $\tree$.
Singletons and the root cluster $\indexset $ belong to all trees, so we refer to them as the \emph{trivial clusters}. 
The cluster set $\cluster{\tree}$ of $\tree$ is defined to be the set of all its vertex clusters,
%
\begin{align}
\cluster{\tree} \ldf \crl{\cluster{v} \big | v \in V_{\tree}} \subseteq \PowerSet{\indexset}, 
\end{align}    
%
where $\PowerSet{\indexset}$ denotes the power set of $\indexset$. 
It is convenient to have $\intcluster{\tree}$ denote
the nontrivial clusters of $\tree$,
%
\begin{align}
\intcluster{\tree} \ldf \crl{I \in \cluster{\tree} \setminus \crl{\indexset} \Big | \card{I} \geq 2}.
\end{align}     



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Cluster Compatibility}
\label{sec:ClusterCompatibility} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{definition}[\cite{schrijver2003, felsenstein2004}]
\label{def.ClusterCompatibility}
Let $A,B$ be  finite sets, then $A$ and $B$ are  said to be \emph{compatible},  $A \compatible B$, if they are disjoint or one is a subset of the other, 
%
\begin{align}
A \cap B = \emptyset \; \logicor  \; A \subseteq B  \; \logicor  \; B \subseteq A.
\end{align}
%
If $A$ and $B$ are incompatible, $A \not \compatible B$, then they are said to \emph{cross}.

If $\mathcal{A}$ and $\mathcal{B}$ are  subsets of  $\PowerSet{\indexset}$, we say that $\mathcal{A}$ and $\mathcal{B}$ are compatible if $A \compatible B$  for all $A\in \mathcal{A} $ and $B \in \mathcal{B}$.
In particular, a cluster $I \in \PowerSet{\indexset}$  is said to be compatible with a tree $\tree \in \treetopspace_{\indexset}$ if $\crl{I} \compatible \cluster{\tree}$, and  two trees $\treeA, \treeB \in \treetopspace_{\indexset}$ are compatible if  $\cluster{\treeA} \compatible \cluster{\treeB}$.
\end{definition}
%
 
It is easy to observe that any two elements of $\cluster{\tree}$ are compatible  for any tree $\tree$, which motivates the following definition: 


\begin{definition} \label{def.nested}
A subset $\mathcal{A}$ of $\PowerSet{\indexset}$  is said to be \emph{nested} (also referred to in the literature as a \emph{laminar family}\cite{schrijver2003}) if  any two elements of $\mathcal{A}$ are compatible.
\end{definition}
%
Note that $\cluster{\tree}$ is also known as the laminar family associated with $\tree$  \cite{schrijver2003}. 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Hierarchical Relations}
\label{sec.HierarchicalRelations }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{figure}

\hfill \includegraphics[width=0.45\textwidth]{hierarchicalrelation.eps} 
\caption{Hierarchical Relations: ancestors - $\ancestorCL{I,\tree}$, parent - $\parentCL{I,\tree}$, children - $\childCL{I,\tree}$,  descendants - $\descendantCL{I,\tree}$, and local complement- $\compLCL{I}{\tree}$  of cluster $\II$ of a rooted binary phylogenetic tree, $\tree \in \bintreetopspace_{\indexset}$, where $\indexset = \crl{1,2,\ldots,13}$. 
Filled and unfilled circles represent interior and leaf nodes, respectively. An interior node is referred by its cluster, the list of leaves below it; for example, $\II = \crl{4,5,6,7}$. }
\label{fig:hierarchicalrelation}
\end{figure}

The cluster set $\cluster{\tree} $ of a hierarchy $\tree$ determines its  representation  as a graph $G_{\tree} = \prl{V_{\tree}, E_{\tree}}$ completely: we have that $\cluster{\tree}$  stands in bijective correspondence with $V_{\tree}$, and $(v, v') \in E_{\tree}$  if and only if  $\cluster{v}\supset \cluster{v'}$ and there is no $\tilde{v} \in V_{\tree}$ such that $\cluster{v}\supset \cluster{\tilde{v}} \supset \cluster{v'}$. 
In particular, we adopt the following notation  
%
\begin{subequations}
\begin{align}
\ancestorCL{I,\tree} &= \left \{ V \hspace{-0.5mm} \in \hspace{-0.5mm} \cluster{\tree} \big | I \subsetneq V \right \},\\
%
\parentCL{I,\tree}  
 &\in \ancestorCL{I,\tree} \setminus \bigcup_{A \in \ancestorCL{I,\tree}} \ancestorCL{A,\tree}, \\
%
\childCL{I, \tree} &= \crl{V \in \cluster{\tree} \big | \parentCL{V,\tree} = I },\\
%
%
\descendantCL{I,\tree} &= \crl{V \hspace{-0.5mm} \in \hspace{-0.5mm} \cluster{\tree}  \big |  V \subsetneq I},
\end{align}
\end{subequations}
%
for the standard notions of, respectively, the set of ancestors,
parents, children and descendants of every cluster $I \in \cluster{\tree}$.  
For the trivial case we set $\parentCL{\indexset, \tree} = \emptyset$.
Because the children comprise a partition of each parent, we find it useful to define the \emph{local complementary} cluster
$\compLCL{I}{\tree}$ of  cluster $I \in \cluster{\tree}$ as
%
\begin{align}\label{eq:compLCL}
\compLCL{I}{\tree} \ldf \parentCL{I,\tree}\setminus I,
\end{align}
%
not to be confused with the standard (global) complement, $\complementCL{I}= \indexset \setminus I$. 
Further, a grandchild in $\tree$ is a cluster $G \in 
\cluster{\tree}$ having a grandparent $\grandparentCL{I,\tree} \ldf \parentCL{\big. \parentCL{I,\tree}, \tree}$ in $\tree$. 
We denote the set of all grandchildren  in $\tree$  by $\grandchildset{\tree}$,
%
\begin{align} \label{eq.grandchild}
\grandchildset{\tree} \ldf \crl{G \in \cluster{\tree} \big | \grandparentCL{G,\tree} \neq \emptyset}.
\end{align} 
%
If $A,B$ are either elements of $\indexset$ or clusters of $\tree$, it is convenient to have $\cancCL{A}{B}{\tree}$ denote  the smallest common ancestor of  $A$ and $B$ in $\tree$,
 %
\begin{align}
\cancCL{A}{B}{\tree} \ldf \argmin_{\substack{I \in \cluster{\tree} \\ A,B \subseteq I }} \card{I}. \label{eq.commonAncestor}
\end{align}
%
Finally, the depth function (or level), $\depth{\tree}:\cluster{\tree} \rightarrow \N$, of hierarchy $\tree$ is defined by: \footnote{Here,  $\card{V}$ denotes the cardinality of $V$.} 
%
\begin{align} \label{eq.Depth}
\depth{\tree}\prl{I} \ldf \card{\ancestorCL{I,\tree}}, \quad \forall I \in \cluster{\tree}.
\end{align} 
%
Thus the depth of a cluster in the tree $\tree$ equals the number of its ancestors in $\tree$.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Nondegeneracy \& Certain Types of Trees}
\label{sec.Nondegeneracy}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A rooted tree where every interior vertex has exactly two children
is said to be binary or non-degenerate. 
All other trees are said to be degenerate. 
We will denote the sets of rooted trees, over a fixed finite leaf set $\indexset$,  by $\treetopspace_{\indexset}$ and the set of non-degenerate rooted trees by $\bintreetopspace_{\indexset}$.

Note that the laminar family $\cluster{\tree}$ of a degenerate tree $\tree$ may always be augmented with additional clusters while remaining nested. 
This leads to the well-known result:

\begin{remark}[\hspace{-0.1mm}\cite{vogtmann_2007, schrijver2003}]  \label{rem:MaximumCardinality}
Let $\tree \in \treetopspace_{\indexset}$. 
Then $\tree$ has at most $2\card{\indexset}-1$ vertices, with equality if and only if $\tree$ is non-degenerate, if and only if $\cluster{\tree}$ is a maximal laminar family in $\PowerSet{\indexset}$ with respect to inclusion\footnote{In this paper we adopt the convention that a laminar family does not contain the empty set (as an element).}.
\end{remark}

%\begin{remark}[\hspace{-0.1mm}\cite{vogtmann_2007, schrijver2003}]  \label{rem:MaximumCardinality}
%The maximum cardinality of a laminar family of nonempty clusters over a fixed finite set $\indexset$ is $2\card{\indexset} -1 $  ( $\card{\indexset}$ singleton clusters and $(\card{\indexset}-1)$ nonsingleton clusters). 
%Further, every nested subset  of  $\PowerSet{\indexset} \setminus \crl{\emptyset}$   of cardinality $2\card{\indexset}- 1$ corresponds to a unique nondegenerate rooted tree $\treetop \in \bintreetopspace_{\indexset}$.
%\end{remark}


\begin{definition}[\hspace{-0.1mm}\cite{owen_provan_tcbb2011}] \label{def:DisjointTree}
Hierarchies $\treeA, \treeB \in \treetopspace_{\indexset}$ are said to be \emph{disjoint} if they have no non-trivial clusters in common.
\end{definition}


\begin{definition} [\hspace{-0.1mm}\cite{rohlf_MB1982, bremer_C1990}] \label{def.StrictLooseConsensus}
For any set of trees $T$ in $\treetopspace_{\indexset}$,  the strict consensus tree $T_{\ast}$ of   $T$ is defined to be the tree consisting of  all common clusters of trees in $T$, i.e.
%
\begin{align}
\cluster{T_{\ast}} = \bigcap_{\tree \in T} \cluster{\tree}, 
\end{align}
%
and the loose consensus tree $T^{\ast}$ of $T$ is the tree  each of whose clusters is a cluster of at least one tree in $T$ and  is compatible with all trees in $T$, i.e.
%
\begin{align}
\cluster{T^{\ast}} = \crl{I \in \bigcup_{\treeB \in T} \cluster{\treeB} \Bigg | \forall \treeA \in T  \quad I \compatible \cluster{\treeA}  }.
\end{align}
\end{definition}
%
Note that the loose consensus tree $T^{\ast}$ of $T$ refines the strict consensus tree $T_{\ast}$, i.e. $\cluster{T^{\ast}} \supseteq \cluster{T_{\ast}}$. 
%If $\mathcal{T}$ contains any nondegenerate hierarchy, then the associated  strict and loose consensus trees are always the same.

%\begin{definition} [\cite{barthelemy_mcmorris_JC1986}]
%Let $T$ be a set of trees in a metric space $\prl{\treetopspace_{\indexset}, \dist}$. 
%A tree $\treetop \in \treetopspace_{\indexset}$ is said to be a median tree of $T$ if the sum of its  distances  to the trees in $T$ is minimum.  
%\end{definition}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Tree Operations}
\label{sec.TreeOperations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{NNI Moves}
\label{sec.NNIMoves} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%One can define  different notions  of neighborhood of a nondegenerate hierarchy $\treetop$ in $\bintreetopspace_{\indexset}$ using a number of tree restructuring operations (or \emph{moves}) \cite{felsenstein2004}, and we are particularly interested in NNI moves. for reasons discussed in \refsec{sec.NNISignificance}.
%
% 
A convenient restatement of the standard definition of NNI walks of unrooted binary trees \cite{robinson_jct1971, moore_goodman_barnabas_jtb1973} for rooted binary trees, illustrated in \reffig{fig.NNImove}, is:


\begin{definition} \label{def:NNIMove}

Let $\treeB \in \bintreetopspace_{\indexset}$.
We say that $\treeA \in \bintreetopspace_{\indexset}$ is the result of performing a  \emph{Nearest Neighbor Interchange}, or \emph{NNI move},  on $\treeB$ at a grandchild $G \in \grandchildset{\treeB}$ if  
%    
\begin{align}
\cluster{\treeA} &= \prl{ \big. \cluster{\treeB} \setminus \crl{\parentCL{G,\treeB}}} \cup \prl{\big.\grandparentCL{G,\treeB} \setminus G}. \label{eq.NNImove}
\end{align} 
%
\end{definition}
%
\begin{figure}[htb]
\centering
\includegraphics[width=0.35\textwidth]{NNImove.eps} 
\caption{An illustration of NNI moves between binary trees, each arrow is labeled by a source tree and associated grandchild defining the move.}
\label{fig.NNImove}
\end{figure}
%
Note that after an NNI move at cluster $G$ of $\treeB$, grandchild $G$ of grandparent $P =  \grandparentCL{G,\treeB}$   with respect to $\treeB$ becomes  child $G$ of parent $P = \parentCL{G,\treeA}$ with respect to the adjacent tree $\treeA$.






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\subsubsection{The NNI-Graph}
\label{sec.NNIGraph}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


We define the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ to have vertex set $\bintreetopspace_{\indexset}$, with two trees connected by an edge if and only if one can be obtained from the other by a single NNI move, see  \reffig{fig:NNIGraph}. 
The NNI-graph on $n$ leaves is a regular graph of degree $2(n-2)$ \cite{robinson_jct1971} \footnote{It is clear that $\card{\mathcal{G}_\tree} = 2(\card{\indexset} - 2)$ for any  $\tree \in \bintreetopspace_{\indexset}$.} and the number of nondegenerate trees in the NNI-graph grows super exponentially with the number of leaves, $n$, \cite{billera_holmes_vogtmann_aap2001},
%
\begin{align}
\card{\bintreetopspace_{[n]}} &= (2n - 3)!! = (2n-3)(2n-5) \ldots 3, \nonumber \\ 
&= \frac{(2n-2)!}{2^{n-1}(n-1)!}, \;\;\; \text{for } n \geq 2. 
\label{eqn:NumEvolutionaryTree}
\end{align}  
%
As a result, an exploration of the entire NNI-graph (for example, searching for the shortest path between hierarchies or an optimal phylogenetic tree model) becomes rapidly more impractical and costly with increasing number of leaves.

\begin{figure}[htb] 
\centering
\includegraphics[width=0.48\textwidth]{ET4NNI.eps} 
\caption{The NNI Graph: a representation  of the space of rooted binary trees, $\bintreetopspace_{\indexset}$, with NNI connectivity, for $\indexset = [n] = \crl{1,2,3,4}$. }
\label{fig:NNIGraph}
\end{figure}

A useful observation for  NNI-adjacent trees is: 
%
\begin{lemma} \label{lem.NNITriple}
An ordered pair of hierarchies $\prl{\treeA,\treeB}$ is an edge in the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ if and only if  there exists one and only one ordered triple $\prl{A,B,C}$ of common clusters of $\treeA$ and $\treeB$ such that  $\crl{A \cup B} = \cluster{\treeA} \setminus \cluster{\treeB}$ and $\crl{B\cup C} = \cluster{\treeB}\setminus \cluster{\treeA}$. 
Call $\prl{A,B,C}$ the ``\emph{NNI-triplet}" of  $\prl{\treeA,\treeB}$.
\end{lemma}
%
\begin{proof}
See \refapp{app.NNITriple} and \reffig{fig.NNImove}.
\end{proof}
%
Observe that the triplet in reverse order $\prl{C,B,A}$ is the NNI-triple associated with the edge $\prl{\treeB, \treeA}$. 
%Thus the six possible ordered triples of $A$, $B$ and $C$ correspond to all edges, in \reffig{fig.NNImove}, of 2-skeleton of the NNI-graph.  
Also note that the NNI moves on $\treeA$ at $A$  and on $\treeB$ at $C$ yield $\treeB$ and $\treeA$, respectively. 
 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Tree Restriction}
\label{sec.TreeRestriction} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{definition}\label{def:TreeRestriction}
Let $\indexset$ be a fixed finite set and $K \subseteq \indexset$.
The restriction map $\treeres{K}:\PowerSet{\indexset} \rightarrow \PowerSet{K}$ is defined to be
%
\begin{align}\label{eq.TreeRestriction}
\treeres{K}\prl{\mathcal{A}} \ldf \crl{A \cap K \Big | A \in \mathcal{A} \, , \; A \cap K \neq \emptyset}
\end{align}
%
for any $\mathcal{A} \subseteq \PowerSet{\indexset}$.
It is convenient to have $\treeressym{K}{\mathcal{A}}$ denote $\treeres{K}\prl{\mathcal{A}}$.

%In particular, $\treetop' \in \treetopspace_{K}$ is said to be the restriction of $\treetop \in \treetopspace_{\indexset}$ to $K$, written as $\treeres{K}\prl{\treetop}$ or $\treeressym{K}{\treetop}$, if and only if $\cluster{\treetop'} = \treeressym{K}{\cluster{\treetop}}$.

For $\treeA \in \treetopspace_{K}$ and $\treeB \in \treetopspace_{\indexset}$ we will write:
%
\begin{align}
\treeA= \treeres{K}\prl{\treeB} \Longleftrightarrow \cluster{\treeA}= \treeressym{K}{\cluster{\treeB}}.
\end{align}

\end{definition}

%\begin{definition}\label{def:TreeRestriction}
%\emph{(Tree Restriction)}
%Let $\indexset$ be a fixed finite set, $K \subseteq \indexset$ and $\treetop \in \treetopspace_{\indexset}$. 
%The restriction map $\treeres{K}:\treetopspace_{\indexset} \rightarrow \treetopspace_{K}$ is defined by setting $\treetop' = \treeres{K}\prl{\treetop}$
%if and only if
%%
%\begin{align} \label{eq:TreeProjection}
%\cluster{\treetop'} = \left\{ I\cap K \, \Big| I \in \cluster{\treetop}\,,\; I\cap K\neq\emptyset \right\}
%%\crl{I' \Big| I' = I \cap K \neq \emptyset, I \in \cluster{\treetop}}.
%\end{align}   
%It is convenient to have $\treeressym{K}{\treetop}$ denote tree restriction.
%\end{definition}


\begin{remark} \label{rem:ClusterConcatenation}
Let $\tree \in \bintreetopspace_{\indexset}$ and $\crl{\indexset_L, \indexset_R} = \childCL{\indexset, \tree}$. Then,  
 %
\begin{equation} \label{eq:ClusterConcatenation}
\cluster{\tree} = \cluster{\treeressym{\indexset_L}{\tree}} \cup \crl{J} \cup \cluster{\treeressym{\indexset_{R}}{\tree}}. 
\end{equation}  
\end{remark}




\begin{lemma} \label{lem:BinTreeRestriction}
For any  finite set $\indexset$ and  $K \subseteq \indexset$ with $\card{K}\geq 2$, $\treeres{K}\prl{\bintreetopspace_{\indexset}}= \bintreetopspace_{K}$. 
\end{lemma}
%
\begin{proof}
See \refapp{app.BinTreeRestriction}.
\end{proof}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Dissimilarities, Metrics and Ultrametrics}
\label{sec.Dissimilarity}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

By a \emph{dissimilarity measure} on $X$, or simply a \emph{ dissimilarity}, we mean $\dist : X \times X \rightarrow \R_{\geq 0}$ on a space $X$ is a nonnegative, symmetric function.
A dissimilarity $\dist$ on $X$ is said to be positive definite if it satisfies $\dist\prl{x,y} = 0 \Longleftrightarrow x=y$ for any $x,y \in X$.
For instance, many approximations  of the (NP-hard) NNI metric are positive definite dissimilarities \cite{li_tromp_zhang_jtb1996, culik_wood_IPL1982, brown_day_JOC1984}.  


\bigskip

A dissimilarity $\dist$ is a metric if it satisfies the triangle inequality,
\begin{align}
\dist\prl{x,y} \leq \dist\prl{x,z} + \dist\prl{z,y}, \quad \forall x,y,z \in X.
\end{align}  
%
For example, we recall the definition of the commonly-used Robinson-Foulds metric on $X = \treetopspace_{\indexset}$:
% 
\begin{definition}[\cite{robinson_foulds_mb1981}] \label{def.RFdistance}
The Robinson-Foulds distance (or simply \emph{symmetric difference distance})   $\distRF: \treetopspace_{\indexset} \times \treetopspace_{\indexset} \rightarrow \R_{\geq 0}$ between a pair of hierarchies $\treeA,\treeB \in \treetopspace_{\indexset}$ is defined to be\footnote{Here, $\ominus$ denotes the symmetric set difference, i.e. $A \ominus B = \prl{A \setminus B} \sqcup \prl{B \setminus A}$ for any sets $A$ and $B$. }
%
\begin{align}\label{eq.RFdistance}
\distRF\prl{\treeA,\treeB} = \frac{1}{2} \card{\big. \cluster{\treeA} \ominus \cluster{\treeB}}. %=\frac{1}{2}\prl{\Big. \card{\cluster{\treeA} \setminus \cluster{\treeB}} +\card{\cluster{\treeB} \setminus \cluster{\treeA}}}. 
\end{align}  
%
\end{definition} 
%
Recently a more discriminative metric was introduced:
%
\begin{definition}[\cite{bogdanowicz_giaro_TCBB2012,lin_rajan_moret_TCBB2012}]
\label{def.MSdistance}
(The Matching Split metric) Let $\treeA, \treeB \in \bintreetopspace_{\indexset}$ and $G_{\indexset}\prl{\treeA, \treeB}$ denote the complete bipartite graph  with sides $\intcluster{\treeA}$ and $\intcluster{\treeB}$, where each edge $\prl{I,J}$ carries the weight\footnote{This corresponds to the hamming distance of clusters.}
%
{\small
\begin{align}
A_S\prl{I,J} = \min\prl{\card{\Big.I \ominus J} , \card{I\ominus \complementCL{J}} }, 
\end{align} 
}
for all $ I \in \intcluster{\treeA}$ and $J \in \intcluster{\treeB}$. 

\emph{The matching split distance} $\distMS:\bintreetopspace_{\indexset} \times \bintreetopspace_{\indexset} \rightarrow \R_{\geq 0}$ between a pair of hierarchies $\treeA$ and $\treeB$ is defined to be the value of a minimum-weighted perfect matching in $G_S\prl{\treeA,\treeB}.$
\end{definition}  
%
Remark that  $\distRF \leq \distMS \leq \frac{\card{\indexset} + 1}{2} \distRF$ \cite{bogdanowicz_giaro_TCBB2012}, which explains the improvement in discriminative power over $\distRF$. 
However, the cost of computing a minimum weighted perfect matching in any $G_{\indexset}\prl{\treeA,\treeB}$  is $\bigO{\card{\indexset}^{2.5}\log \card{\indexset}}$, which motivates the search for dissimilarities bounding $d_{RF}$ from above but having a lower computational cost.

\bigskip

An ultrametric $\dist: X \times X \rightarrow \R$ is a metric on $X$ satisfying the following strong form of the triangle inequality:
\begin{align}
\dist\prl{x,y} \leq \max\prl{\big. \dist\prl{x,z},\dist\prl{z,y}}.
\end{align}  
%
A restatement of a well-known fact \cite{carlsson_memoli_jmlr2010, jain_dubes_1988, rammal_et_al_RMP1986} revealing the
relation between hierarchies and ultrametrics is:

\begin{lemma} [\cite{carlsson_memoli_jmlr2010}] \label{lem.treeUltrametric}
Let $\tree \in \treetopspace_{\indexset}$  and $h_{\tree} :\cluster{\tree} \rightarrow \R_{\geq 0}$. 
%
Then the following dissimilarity on $\indexset$ associated with $\tree$, 
%
\begin{align} \label{eq.treeUltrametric}
 \dist_{\tree}\prl{i,j}  \ldf h_{\tree} \prl{\big. \cancCL{i}{j}{\tree}}, \quad \forall i,  j \in \indexset, 
\end{align}  
%
is an ultrametric if and only if the followings are satisfied for any $ I,J \in \cluster{\tree}$:
%
\renewcommand{\theenumi}{\roman{enumi}}
\begin{enumerate} 
\item \label{it.heightMonotonicity} if $I \subseteq J$, then $h_{\tree}\prl{I} \leq h_{\tree}\prl{J}$,
\item \label{it.heightIndiscernible}$h_{\tree}\prl{I} = 0$ if and only if $\card{I}= 1$.
\end{enumerate}
%
\end{lemma}
%
\begin{proof}
See \refapp{app.treeUltrametric}.
\end{proof}

\bigskip

In general, a set $X$  can inherit a metric from a metric space $\prl{Y,\dist_{Y}}$ by embedding $X$ into $Y$ through an injective function $f : X \rightarrow Y$; that is to say,
\begin{align}
\dist_{X}\prl{x_1, x_2} \ldf \dist_{Y}\prl{f\prl{x_1}, f\prl{x_2}}, \quad \forall x_1, x_2 \in X,
\end{align} 
is a metric on $X$. 
$\dist_X$ is known as the pullback metric of $\dist_Y$ along $f$.
In fact, the RF metric is a pullback metric: it is common knowledge that the set $F\prl{X}$ of all finite subsets of a set $X$ forms a metric space under the metric $\dist\prl{A,B}= \card{A \ominus B}$, which is one of the ways of defining hamming distance. 
Thus, the RF distance is (one half times) the pullback of this metric on $F\prl{\PowerSet{\indexset}}$ under the map $\tree \mapsto \cluster{\tree}$.

\reflem{lem.treeUltrametric} provides us with a tool for constructing various embeddings of the space of trees in the space of (ultra-)metrics on $\indexset$, which, in turn, can be identified with a subspace of $\R^{\card{\indexset}\times\card{\indexset}}$. 
A metric on $\treetopspace_{\indexset}$ constructed by pullback of matrix norms under this embedding is introduced in the next section.






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Discriminative Comparison of Edges}
\label{sec.EdgeComparison}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

In this section, we shall introduce a new tree metric
based on ultrametric representation of hierarchies and
a  dissimilarity measure counting pairwise cluster compatibilities of trees.




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The Cluster-Cardinality Distance}
\label{sec.CCdistance}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
We now introduce an embedding of hierarchies into the space of matrices based on the relation between  hierarchies and ultrametrics, summarized in \reflem{lem.treeUltrametric}: 

\begin{definition}
The \emph{ultrametric representation} is the map $\mat{U} : \treetopspace_{\indexset} \rightarrow \R^{\card{\indexset}  \times \card{\indexset} }$, defined by 
%
\begin{align}
\mat{U}(\tree)_{ij} \ldf h \prl{ \big. \cancCL{i}{j}{\tree}}, \label{eq.UltrametricMat}
\end{align}
%
where $ h : \PowerSet{\indexset} \rightarrow \N$ is set as
%
\begin{align}
h\prl{I} \ldf  \card{I} - 1, \quad \forall I \subseteq \indexset. \label{eq.clustercardinalityheight}
\end{align}
\end{definition}

\begin{lemma}
 The map $\mat{U}$ is injective.
\end{lemma} 
%
\begin{proof}
By \reflem{lem.treeUltrametric}, $\mat{U}\prl{\tree}$ is an ultrametric representation of any $\tree \in \treetopspace_{\indexset}$ since $h$ \refeqn{eq.clustercardinalityheight} satisfies both conditions of \reflem{lem.treeUltrametric}.

To see the injectivity of $\mat{U}$   \refeqn{eq.UltrametricMat}, we shall show that $\mat{U}\prl{\treeA} \neq \mat{U}\prl{\treeB}$ for any  $\treeA \neq \treeB \in \treetopspace_{\indexset}$. 

Recall that two trees $\treeA, \treeB \in \treetopspace_{\indexset}$ are distinct if and only if they have at least one unshared cluster.
Accordingly, for any $\treeA \neq \treeB \in \treetopspace_{\indexset}$ consider a common cluster $I \in \cluster{\treeA} \cap \cluster{\treeB}$ with distinct parents $\parentCL{I,\treeA} \neq \parentCL{I,\treeB}$. 
Depending on the cardinality of parent clusters: 

\begin{itemize}

\item If $\card{\parentCL{I,\treeA}} = \card{\parentCL{I,\treeB}}$, then observe that there  exists some $j \in \parentCL{I,\treeA}$ and  $j \not \in \parentCL{I,\treeB}$ since $\parentCL{I,\treeA} \neq \parentCL{I,\treeB}$. 
In fact, notice that  $j \in \compLCL{ I}{\treeA}$ and $j \not \in \compLCL{ I}{\treeB}$ (recall  \refeqn{eq:compLCL}). 
Hence, we have  $\cancCL{i}{j}{\treeA} = \parentCL{I,\treeA}$ and $\parentCL{I,\treeB} \subsetneq \cancCL{i}{j}{\treeB}$ for any $i \in I$. 
Thus, it is clear that
%
\begin{align}
\mat{U}\prl{\treeA}_{ij} \sqz{=} \card{\parentCL{I,\treeA}} \sqz{-}1 \sqz{<} \mat{U}\prl{\treeB}_{ij} \sqz{=} \card{\big. \cancCL{i}{j}{\treeB}} \sqz{-}1,
\end{align}
%  
for any $i \in I$.
\vspace{2mm}

\item Otherwise ($\card{\parentCL{I,\treeA}} \neq \card{\parentCL{I,\treeB}}$), without loss of generality, let $\card{\parentCL{I,\treeA}} < \card{\parentCL{I,\treeB}}$. 
Then, one can easily observe that 
%
\begin{align}
\mat{U}\prl{\treeA}_{ij} \sqz{=} \card{\parentCL{I,\treeA}} \sqz{-}1 \sqz{<} \mat{U}\prl{\treeB}_{ij} \sqz{=} \card{\big. \cancCL{i}{j}{\treeB}} \sqz{-}1,
\end{align}
%  
for any $i \in I$ and $j \in \compLCL{I}{\treeA}$ since $\cancCL{i}{j}{\treeB} \supseteq \parentCL{I,\treeB}$.

\end{itemize}

Therefore, $\mat{U}\prl{\treeA} \neq \mat{U}\prl{\treeB}$ for any $\treeA \neq \treeB \in \bintreetopspace_{\indexset}$, and the result follows.
\end{proof}


\bigskip

Using the embedding $\mat{U}$   of $\treetopspace_{\indexset}$ into $\R^{\card{\indexset} \times \card{\indexset}}$ \refeqn{eq.UltrametricMat},   we can define different notions of  tree metrics  as the pullback metrics of  various matrix norms as one below:

\begin{definition} \label{def:ClusterCardinalityDist}
\emph{The cluster-cardinality metric}, $\distCC:\treetopspace_{\indexset} \times \treetopspace_{\indexset} \rightarrow \R_{\geq 0}$, in $\treetopspace_{\indexset}$ is defined to be
\footnote{$\norm{.}_1$ denotes elementwise 1-norm of a matrix, i.e. $ \norm{\mat{U}}_1 \ldf \sum_{i=1}^{n} \sum_{j=1}^{n} \absval{\mat{U}_{ij}}$ for all $\mat{U} \in \R^{n \times n}$.}
%
\begin{align}\label{eq.CCdistance}
\distCC\prl{\treeA,\treeB} \ldf \frac{1}{2}\norm{\big. \mat{U}\prl{\treeA} - \mat{U}\prl{\treeB}}_{1},  \quad \forall \treeA, \treeB \in \treetopspace_{\indexset}.
\end{align} 
\end{definition}
%
Here, we find the 1-norm convenient to illustrate the relation between $\distCC$ and our dissimilarity measures $\dist_{CM}$ and $\dist_{Nav}$  later. 

\begin{proposition}\label{prop:CCdistanceCost}
The cluster cardinality distance $\distCC : \treetopspace_{\indexset} \times \treetopspace_{\indexset}\rightarrow \R_{\geq 0}$ between a pair of hierarchies over a finite fixed leaf set $\indexset$ can be computed in $\bigO{\card{\indexset}^2}$ time. 
\end{proposition}
%
\begin{proof}
The 1-norm of difference of a pair of $\card{J} \times \card{J}$ matrices obviously requires $\bigO{\card{\indexset}^2}$ time to compute, which is the lower bound of the computation cost of $\distCC$. 
Now, we shall show that the embedding $\mat{U}$ \refeqn{eq.UltrametricMat} can also be efficiently obtained with the same computational cost, $\bigO{\card{\indexset}^2}$, by post-order traversal, visiting children first and then the parent, of trees. 

To show the result we follow a proof by induction based on the post order tree traversal. 
For any $\tree \in \treetopspace_{\indexset}$:

\begin{itemize}

\item (Base case) For the two-leaf tree $\tree\in \bintreetopspace_{\brl{2}}$, i.e.  $\card{\indexset} = 2$, the result simply follows since $\mat{U}\prl{\tree} = \twomatrix{0}{1}{1}{0}$.  

\item (Induction) Otherwise ($\card{S}\geq 3$), let $\crl{\indexset_k}_{1 \leq k \leq K} = \childCL{\indexset,\tree}$, where $K \geq 2$ is the number of children of the root $\indexset$ in $\tree$.
Note that for any  $\card{\indexset_k} = 1$, say $\indexset_k = \crl{i}$  for some $i \in \indexset$, $\mat{U}\prl{\tree}_{ii}= 0$. Hence, each element of $\mat{U}\prl{\tree}$ associated with a singleton child, $\card{\indexset_k} = 1$, can be updated in constant, $\bigO{1}$, time. 
Suppose that the relevant elements of $\mat{U}\prl{\tree}$ associated with the subtree rooted at $\indexset_k$ can be computed in $\bigO{\card{\indexset_k}^2}$ time for any $1 \leq k \leq K$ and $\card{\indexset_k}\geq2$.  
Then, the total number of  updates associated with the root $\indexset$ is $\sum_{k = 1}^{K} \sum_{l =1}^K \card{\indexset_k}\card{\indexset_l} $  and  corresponds to setting $\mat{U}\prl{\tree}_{ij} =\mat{U}\prl{\tree}_{ji}= \card{\indexset} - 1$ for all $i \in \indexset_k$, $ j \in \indexset_l$ and $1 \leq k,l \leq K$.
Here, remark that one can  obtain  cluster of  each vertex of $\tree$  and its size in linear time during the post-order traversal of $\tree$ using $\indexset = \bigcup_{k =1}^{K} \indexset_k $ and $\card{\indexset} = \sum_{k=1}^{K}\card{\indexset_k}$. 
Hence, all clusters and their size can be obtained in $\bigO{\card{J}^2}$ time by a single post-order traversal.   
Thus, the total cost of obtaining $\mat{U}\prl{\tree}$ by a single post-order traversal is $\sum_{k =1}^{K}\bigO{\card{\indexset}_k^2}  + \sum_{k = 1}^{K} \sum_{l=1}^{K} \card{\indexset_k}\card{\indexset_l} + \bigO{\card{\indexset}^2}= \bigO{\card{\indexset}^2}$.% since $\sum_{k =1}^{K}\card{\indexset_k}^2  + \sum_{k = 1}^{K} \sum_{l=1}^{K} \card{\indexset_k}\card{\indexset_l} = \prl{\sum_{k =1}^{K} \card{\indexset_k}}^2 = \card{\indexset}^2 $. 
\end{itemize}

Thus, the result follows.
\end{proof}

\bigskip

It is always of interest to know  the diameter, $\diam{X,\dist}$, of a finite metric space $\prl{X,\dist}$,
%
\begin{align}
\diam{X,\dist} \ldf \max \crl{\dist\prl{x,y} \big |x,y \in X}. \label{eq.diameter}
\end{align}
%
Accordingly, the diameters of the set of hierarchies over a finite leaf set $\indexset$ in various metrics \cite{bogdanowicz_giaro_TCBB2012, lin_rajan_moret_TCBB2012, sleator_tarjan_thurston_stoc1986}  are 
%
\begin{align}
\diam{\treetopspace_{\indexset}, \distRF} &= \card{\indexset} - 2,\\
\diam{\bintreetopspace_{\indexset}, \distMS} &= \bigO{\card{\indexset}^2}, \\
\diam{\bintreetopspace_{\indexset}, \distNNI} &= \bigO{\card{\indexset}\log \card{\indexset}}, 
\end{align}
%
and the diameter of the set of all trees in the cluster-cardinality distance is:

\begin{proposition}
$\diam{\treetopspace_{\indexset},\distCC} = \bigO{\card{\indexset}^3}$.
\end{proposition}
%
\begin{proof}
It is evident from \refeqn{eq.clustercardinalityheight} that the minimum and maximum ultrametric distances between two different elements of $\indexset$ are, respectively,  1 and $\card{\indexset} - 1$. 
Hence, the maximum elementwise difference of zero-diagonal $\card{\indexset} \times \card{\indexset}$ matrices in \refeqn{eq.CCdistance} is $\card{\indexset} - 2$. 
Moreover, using the tight upper bound on the change of the cluster cardinality distance after a single NNI move in \refprop{prop:NNIClusterCardinality}, the range of the diameter of $\treetopspace_{\indexset}$ in the cluster cardinality metric can be obtained as
%
\begin{align}
\left \lfloor \frac{2}{27}\card{\indexset}^3 \right \rfloor \leq \diam{\treetopspace_{\indexset},\distCC} \leq \frac{1}{2}\card{\indexset}\prl{\card{\indexset}-1}\prl{\card{\indexset}-2},
\end{align} 
%
which completes the proof.
\end{proof}

\bigskip

A common and natural question regarding any distance being proposed for the space of trees is how  it behaves with respect to certain tree rearrangements. 
For instance,  NNI-adjacent hierarchies, $\treeA, \treeB \in \bintreetopspace_{\indexset}$,  are known to satisfy \cite{bogdanowicz_giaro_TCBB2012}
%
\begin{align}
&\dist_{NNI}\prl{\treeA,\treeB} = 1 \Longleftrightarrow \distRF\prl{\treeA,\treeB} = 1, \\
&\dist_{NNI}\prl{\treeA,\treeB} = 1 \Longrightarrow  2 \leq \distMS\prl{\treeA,\treeB} \leq \left \lfloor \frac{\card{\indexset}}{2} \right \rfloor .
\end{align} 
%
Accordingly, an important observation relating $\distCC$ to the NNI moves is:

\begin{proposition} \label{prop:NNIClusterCardinality}
Let $\prl{\treeA,\treeB}$ be an edge of the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ and $\prl{A,B,C}$ be the associated NNI triplet. 
Then, the cluster-cardinality distance between $\treeA$ and $\treeB$ satisfies
%
\begin{align}\label{eq.CC_NNI_range}
2 \leq \distCC\prl{\treeA,\treeB} =  2\card{A}\card{B}\card{C} \leq \left \lfloor \frac{2}{27}\card{\indexset}^3 \right \rfloor,
\end{align}
and both bounds are tight.\footnote{$\lfloor.\rfloor$ denotes the floor operator returning the largest integer not greater than its operand. }
\end{proposition}
%
\begin{proof}
Let $P = A \cup B \cup C$ and, recall that $A \cup B \in \cluster{\treeA}$ and $B \cup C \in \cluster{\treeB}$. 
Here, note that $P \in \cluster{\treeA} \cap \cluster{\treeB}$ is a common (grand)parent cluster, and $A$, $B$ and $C$ are pairwise disjoint.  


Since the NNI moves between $\treeA$ and $\treeB$ only change the relative relations of clusters $A,B$ and $C$, the distance between $\treeA$ and $\treeB$ can be rewritten as 
%
{\small
\begin{align}
\distCC\prl{\treeA,\treeB} &= \frac{1}{2}\norm{\mat{U}\prl{\treeA} - \mat{U}\prl{\treeB}}_1, \\
%
&= \sum_{\substack{i\in A \\ j \in B}} \absval{\mat{U}\prl{\treeA}_{ij} - \mat{U}\prl{\treeB}_{ij}} \sqz{+}  \sum_{\substack{i\in A \\ j \in C}} \absval{\mat{U}\prl{\treeA}_{ij} - \mat{U}\prl{\treeB}_{ij}} \nonumber \\
%
& \hspace{10mm} +  \sum_{\substack{i\in B \\ j \in C}} \absval{\mat{U}\prl{\treeA}_{ij} - \mat{U}\prl{\treeB}_{ij}}, \\
%
& =  \sum_{\substack{i\in A \\ j \in B}} \underbrace{\absval{ h\prl{A \sqcup B} - h\prl{P}}}_{=\card{C}}  + \sum_{\substack{i\in A \\ j \in C}} \underbrace{\absval{h\prl{P} - h\prl{P}}}_{=0} \nonumber\\ 
& \hspace{10mm} +  \sum_{\substack{i\in B \\ j \in C}} \underbrace{\absval{h\prl{P} - h \prl{B \cup C} }}_{=\card{A}}, \\
& =  2\card{A}\card{B}\card{C}.
\end{align}
}
%
The lower bound in \refeqn{eq.CC_NNI_range} is clearly realized when $\card{A}=\card{B}=\card{C}=1$. 
Moreover, one can simply verify that the maximum product of three numbers whose sum is constant occurs when all the numbers are equal. 
In our case, $\card{A}+\card{B} + \card{C} \leq \card{\indexset}$, and so $\card{A}\card{B} \card{C} \leq \left \lfloor\frac{\card{\indexset}^3}{27} \right \rfloor$ since $\card{.}$ is integer-valued. 
Thus, the result follows. 
\end{proof}

\bigskip

Note that neither $\distMS$ and nor $\distCC$  completely capture the NNI-adjacency as $\distRF$ does since neither of them  provide a linear lower bound on the NNI distance $\distNNI$:
%
\begin{lemma}\label{lem.GraphMetricLowerBound}
Let $\prl{X,d_X}$ be a metric space and $G = \prl{X,E,A}$ be a weighted undirected connected graph comprising the set $X$ of vertices, a set $E$ of edges and  $A: E \rightarrow \R_{\geq 0}$ a weight function on $E$. 
Let $\dist_{G}:X \times X \rightarrow \R$ denote the sum of edge weights along the shortest path  in $G$ joining a pair of elements of $X$. 

If $\dist_X\prl{x,y} \leq A\prl{x,y}$ for all $\prl{x,y} \in E$, then $\dist_{X}\prl{x,y} \leq \dist_G\prl{x,y}$ for all $x,y \in X$.
\end{lemma}
\begin{proof}
The result simply follows from the triangle inequality of $\dist_X$,  see \refapp{app.GraphMetricLowerBound}.
\end{proof}

\bigskip

Here are some useful applications of \reflem{lem.GraphMetricLowerBound}:

\begin{corollary} \label{cor:NNI_RF_bound}
For all nondegenerate hierarchies $\treeA,\treeB \in \bintreetopspace_{\indexset}$,
\begin{align}
\distRF\prl{\treeA,\treeB} \leq \dist_{NNI}\prl{\treeA,\treeB}.
\end{align}
\end{corollary}

\begin{corollary}
Let $\dist$ be a dissimilarity on $\bintreetopspace_{\indexset}$ with the property that $\dist\prl{\treeA,\treeB} \leq 1$ for all $\treeA,\treeB \in \bintreetopspace_{\indexset}$ and $\dist_{NNI}\prl{\treeA,\treeB} = 1$.

If $\dist\prl{\treeA,\treeB}> \dist_{NNI}\prl{\treeA,\treeB}$ for some $\treeA,\treeB \in \bintreetopspace_{\indexset}$, then $d$ is not a metric. 

\end{corollary}

\begin{corollary} \label{cor.CMdistanceNotMetric}
The crossing dissimilarity, $\distCM$ \refeqn{eq.CMdistance}, and NNI navigation dissimilarity, $\distNav$ \refeqn{eq:NavPathLength},  are not metrics.
\end{corollary}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The Crossing Dissimilarity}
\label{sec.CMdistance}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

We define  \emph{the compatibility matrix}, $\CMat\prl{\treeA,\treeB}$, of a pair of hierarchies $\treeA,\treeB \in \treetopspace_{\indexset}$
to be the binary matrix\footnote{$\CMat\prl{\treeA,\treeB}$ and $\XMat\prl{\treeA, \treeB}$ can be defined only in terms of nontrivial clusters of $\treeA$ and $\treeB$ since any two trivial clusters are always compatible with each other. 
However, this might result with matrices of zero dimension since  a tree might have no nontrivial clusters. } 
%
\begin{align}
\CMat\prl{\treeA,\treeB}_{I,J} \ldf \indicatorfunc{I \compatible J},  \label{eqn.CMat}
\end{align}
%
for all  $\forall I \in \cluster{\treeA}$ and $ J \in \cluster{\treeB}$, where $\indicatorfunc{.}$ is the standard indicator function which returns unity if its argument is true; otherwise returns zero. 
%
Their \emph{crossing matrix},  $\XMat\prl{\treeA,\treeB}$, is defined to be 
%
\begin{align}
\mat{X}\prl{\treeA,\treeB} \ldf \mat{1} - \CMat\prl{\treeA,\treeB}, \label{eqn.XMat}
\end{align}
%
where $\mat{1}$ is the matrix of all ones of the appropriate size.

We propose a new dissimilarity, called \emph{the crossing dissimilarity} $\distCM$,  between a pair of nondegenerate hierarchies, $\treeA,\treeB \in \treetopspace_{\indexset}$, to be 
%
\begin{align}\label{eq.CMdistance}
\distCM\prl{\treeA,\treeB} \ldf \norm{\XMat\prl{\treeA,\treeB}}_1,
\end{align}
%
that counts pairwise cluster incompatibilities of trees.
We find it convenient to use the 1-norm of the crossing matrix to easily reveal possible relations between $\dist_{CM}$ and $\distCC$ \refeqn{eq.CCdistance}, but one can use any appropriate matrix norms to define alternative dissimilarities.

We now continue with a list of significant properties of $\dist_{CM}$ including its relation with certain tree rearrangements and alternative tree metrics: 

 
\begin{remark} \label{rem.distCMNotMetric}
The crossing  dissimilarity $\dist_{CM}$ \refeqn{eq.CMdistance} in $\bintreetopspace_{\indexset}$ is positive definite and  symmetric, but it is not a metric (\refcor{cor.CMdistanceNotMetric}).\footnote{Note that $\dist_{CM}:\treetopspace_{\indexset}\times \treetopspace_{\indexset} \rightarrow \R$ is nonnegative and symmetric.} 

\end{remark} 
%
\begin{figure}[htb]
\centering
\includegraphics[width=0.49 \textwidth]{CMatNormNavLengthNotMetricv2.eps} 
\caption{ $\distCM$ and $\distNav$ are not metrics: an example of the triangle inequality failing for both dissimilarities.}
\label{fig:CMatNormNavLengthNotMetric}
\end{figure}

%\begin{proof}
%By the definition of elementwise 1-norm of a matrix\addtocounter{footnote}{-3}\footnotemark \addtocounter{footnote}{2}  and \refrem{rem:MaximumCardinality}, $\dist_{CM}$ is clearly positive definite and symmetric. 
%
%We are left to construct a counter example. 
%Consider the following three binary hierarchies  over the index set $\indexset= \brl{4}=\crl{1,2,3,4}$ given in Newick format \cite{felsenstein2004} $\treetop=(((1,2),3),4)$, $\treetop^*=(1,(2,(3,4)))$ and $\treetop'=((1,2),(3,4))$  (see \reffig{fig:CMatNormNavLengthNotMetric}). 
%It can be easily verified that 
%$\dist_{CM}\prl{\treetop, \treetop^*} = 3$,
%$\dist_{CM}\prl{\treetop, \treetop'} = 1$ and 
%$\dist_{CM}\prl{\treetop',\treetop^*} = 1$, 
%and so $\dist_{CM}\prl{\treetop,\treetop^*} > \dist_{CM}\prl{\treetop, \treetop'} + \dist_{CM}\prl{\treetop',\treetop^*}$. 
%Thus, the crossing-\right  $\dist_{CM}$ in $\bintreetopspace_{\indexset}$ is not a metric since  it does not satisfy the triangle inequality even though it does positive definiteness and symmetry.  
%%
%%
%\end{proof}
 
\begin{proposition}\label{prop:CMdistanceCost}
The crossing dissimilarity $\dist_{CM}:\treetopspace_{\indexset} \times \treetopspace_{\indexset} \rightarrow \R_{\geq 0}$ between any pair of hierarchies over a finite  fixed leaf set $\indexset$ can be computed in $\bigO{\card{\indexset}^2}$ time. 
\end{proposition} 
%
\begin{proof}
The crossing-matrix $\XMat\prl{\treeA,\treeB}$ \refeqn{eqn.XMat} of a pair of hierarchies  $\treeA, \treeB \in \treetopspace_{\indexset}$ has at most $2\card{\indexset} -1$ rows and columns.
Hence, the 1-norm of a known crossing matrix $\XMat\prl{\treeA,\treeB}$ requires $\bigO{\card{\indexset}^2}$ time to compute, which bounds the cost of $\dist_{CM}$ from below.
We shall show that $\XMat\prl{\treeA, \treeB}$  can be obtained in $\bigO{\card{\indexset}^2}$ time by post-order traversals of trees. 

Recall from \refdef{def.ClusterCompatibility} that for any sets $A$ and $B$ %the computation of  $A \compatible B$ might require the determination of set inclusions, $A \subseteq B$ and $B \subseteq A$, and their disjointness, $A \cap B = \emptyset$.
\begin{align} \label{eq.comptemp}
A  \compatible B \Longleftrightarrow \prl{A  \subseteq B} \logicor \prl{B \subseteq A}  \logicor \prl{A \cap B = \emptyset}.
\end{align}


Let $\treeA,\treeB \in \treetopspace_{\indexset}$, and  $I \in \cluster{\treeA}$ and $J \in \cluster{\treeB}$.
If at least one of $I$ or $J$ is a singleton, then the cluster inclusions $I \subseteq J$, $J \subseteq I$ and their disjointness can be determined in constant time using a hash map.
Otherwise, $\card{I} \geq 2$ and $\card{J} \geq 2$, observe the following recursions
%
\begin{align}
I \subseteq J & \Longleftrightarrow D \subseteq J, \quad &&\forall D \in \childCL{I, \treeA}, \\
I \cap J = \emptyset &\Longleftrightarrow D \cap J = \emptyset, \quad &&\forall D \in \childCL{I,\treeA}. 
\end{align}
%
Hence, for any cluster $J \in \cluster{\treeB}$, one can easily check whether  $J$ is disjoint with or a superset of each cluster $I$ of $\treeA$ by a post-order traversal of $\treeA$ in linear, $\bigO{\card{\indexset}}$, time, and vice versa. 
Thus, all the pairwise inclusions and disjointness of clusters of $\treeA$ and $\treeB$ can be  computed in $\bigO{\card{\indexset}^2}$ time.
As a result, using \refeqn{eq.comptemp} $\XMat\prl{\treeA,\treeB}$ can be obtained with the same cost, $\bigO{\card{\indexset}^2}$, which completes the proof.  
\end{proof}
 
\begin{proposition} \label{prop.CMdiameter}
The diameter $\diam{\treetopspace_{\indexset},\dist_{CM}}$ \refeqn{eq.diameter} of the set of hierarchies over a fixed finite index set $\indexset$ with respect to the crossing dissimilarity $\dist_{CM}$ \refeqn{eq.CMdistance} is 
%
\begin{align} \label{eq.CMdiameter}
\diam{\treetopspace_{\indexset}, \dist_{CM}} = \prl{\card{\indexset} - 2}^2. 
\end{align}
\end{proposition}
%
\begin{proof}
Note that  the number of nontrivial clusters of a tree  in $\treetopspace_{\indexset}$ is at most $\card{\indexset} -2$  (\refrem{rem:MaximumCardinality}). 
Hence, an upper bound on $\diam{\treetopspace_{\indexset}, \dist_{CM}}$ is $\prl{\card{\indexset} -2}^2$. 
To observe that this upper bound is realized, see  \reffig{fig.distCMdistNavDiameter}.
%let us consider two hierarchies $\treetop = (((\ldots (((1,2),3),4), \ldots),n-1),n)$ and $\treetop' = (((\ldots (((n,2),3),4), \ldots),n-1),1)$ given in Newick format \cite{felsenstein2004}. 
%One can easily verify that $\dist_{CM}\prl{\treetop,\treetop'} = \prl{n-2}^2$, which complete the proof. 
%\ToDo{Include a figure.}
\end{proof} 

\begin{figure}[htb] 
\centering
\includegraphics[width=0.45\textwidth]{distCMdistNavDiameter.eps} 
\caption{A pair of nondegenerate hierarchies realizing  
 $\diam{\treetopspace_{\brl{n}}, \distCM} = \prl{n - 2}^2$ and 
 $\diam{\bintreetopspace_{\brl{n}}, \distNav} = \frac{1}{2}\prl{n - 1}\prl{n -2}$.
  }
  \label{fig.distCMdistNavDiameter}
\end{figure}
 
\begin{lemma} \label{lem.NNI_CM_neighbor}
Two non-degenerate hierarchies are NNI-adjacent if and only if they are crossing-adjacent, that is:\footnote{In a finite metric space $\prl{X,\dist}$, two  elements $x \neq y \in X$  are said to be adjacent if their distance is equal to the minimum nonnegative value of $\dist$ in $X$, i.e. $\dist\prl{x,y} = \min\crl{\dist\prl{x',y'}| x' \neq y' \in X}$.   }
%
\begin{align}
\dist_{NNI}\prl{\treeA,\treeB} &= 1 \Longleftrightarrow \dist_{CM}\prl{\treeA,\treeB} = 1,  \label{eq.NNI_CM}
%\\
%0 \leq &\dist_{CM}\prl{\treeA,\treeB}  \leq \prl{\card{\indexset} - 2}^2, \label{eq.CMRange}
\end{align}
%
for all $\treeA,\treeB \in \bintreetopspace_{\indexset}$
\end{lemma}
% 
\begin{proof}
The result is simply evident from \refrem{rem:MaximumCardinality} and \refdef{def:NNIMove} on page 3. 
\end{proof} 

Here, note that $\dist_{CM}$ and $\dist_{NNI}$ define the same adjacency  in $\bintreetopspace_{\indexset}$ (\reflem{lem.NNI_CM_neighbor}), but  $\dist_{CM}$ does not provide a linear lower bound on $\dist_{NNI}$ since $\diam{\bintreetopspace_{\indexset}, \dist_{NNI}} = \bigO{\card{\indexset} \log \card{\indexset}} < \diam{\bintreetopspace_{\indexset}, \dist_{CM}} = \bigO{\card{\indexset}^2}$ (\refprop{prop.CMdiameter}).
This inequality provides us with an additional, more conceptual, argument that $\distCM$ is not a metric, by applying \reflem{lem.GraphMetricLowerBound}.


\begin{proposition} \label{prop:CM_RF_bound}
The crossing  dissimilarity  between any pair of nondegenerate hierarchies, $\treeA, \treeB \in \bintreetopspace_{\indexset}$, has tight (linear) lower  and (quadratic) upper bounds with respect to the RF distance, 
%
\begin{align} \label{eq.CM_RF_bounds}
\distRF\prl{\treeA, \treeB} \leq \dist_{CM}\prl{\treeA, \treeB} \leq \distRF\prl{\treeA, \treeB}^2.
\end{align}
\end{proposition}

\begin{proof}
The lower bound directly follows from \refrem{rem:MaximumCardinality} since a pair of distinct hierarchies always have uncommon clusters and  an unshared cluster of one tree crosses at least one unshared cluster of the other tree.
This bound is  tight since
%
\begin{align}
\distRF\prl{\treeA, \treeB} \sqz{=} 1 
\Leftrightarrow 
\dist_{NNI}\prl{\treeA, \treeB} \sqz{=} 1 
\Leftrightarrow 
\dist_{CM}\prl{\treeA, \treeB} \sqz{=} 1,
\end{align}
%
for any $\treeA, \treeB \in \bintreetopspace_{\indexset}$.

For any $\treeA, \treeB \in \bintreetopspace_{\indexset}$, the columns and rows of  $\XMat\prl{\treeA, \treeB}$ \refeqn{eqn.XMat} associated with common clusters of trees have all zeros. 
Hence, each nonzero element of  $\XMat\prl{\treeA, \treeB}$ is associated with a pair of unshared clusters of $\treeA$ and $\treeB$.
The number of   unshared cluster pairs of nondegenerate trees  $\treeA$ and $\treeB$ is equal to $\distRF\prl{\treeA, \treeB}^2$, which defines the upper bound in \refeqn{eq.CM_RF_bounds}. 
To observe that this bound is also tight, see  \reffig{fig.distCMdistNavDiameter}. 
\end{proof}
 
\begin{proposition} \label{prop:CM_CC_bound}
The crossing dissimilarity is  bounded from above  by the cluster-cardinality distance, 
%
\begin{align}
\dist_{CM}\prl{\treeA,\treeB} \leq \distCC\prl{\treeA,\treeB}, \quad \forall \treeA,\treeB \in \treetopspace_{\indexset} .
\end{align}
%for any $\treetop, \treetop' \in \treetopspace_{\indexset}$,
\end{proposition} 
%
\begin{proof}
%
Let $\treeA,\treeB \in \treetopspace_{\indexset}$.
Throughout this proof, the symbols $I$ and $J$ denote clusters in $\cluster{\treeA}$ and $\cluster{\treeB}$, respectively, and $i,j \in \indexset$.

We shall introduce a function $q : \cluster{\treeA} \times \cluster{\treeB} \rightarrow S \times S$ with the following properties:
% 
\renewcommand{\theenumi}{\roman{enumi}}
\begin{enumerate}
\item \label{it.q1} for any  $I$ and $J$,  
$ I \compatible J \Longleftrightarrow i = j $ whenever $\prl{i,j} = q\prl{I,J}$, 
\item \label{it.q2} for any $i \neq j $,  $\card{q^{-1}\prl{i,j}} \leq \absval{\mat{U}\prl{\treeA}_{ij} - \mat{U}\prl{\treeB}_{ij}}$.  
\end{enumerate}
%
Hence, one can easily observe that
%
\begin{align} \label{eq.crossingsqinverse}
\bigcup_{i \neq j \in S} q_{\treeA,\treeB}^{-1}\prl{i,j} = \crl{\prl{I,J}  \Big | I \not \compatible J}.
\end{align}
%
As a result, it is evident from  \refeqn{eq.crossingsqinverse} that
\begin{align}
\distCM\prl{\treeA, \treeB} = \sum_{i \neq j \in \indexset} \card{q_{\treeA,\treeB}^{-1}\prl{i,j}} \leq \distCC\prl{\treeA,\treeB}.
\end{align} 

%Let    $I \in  \cluster{\treeA}$ and $J \in \cluster{\treeB}$. 
Observe that if $I \not \compatible J$, then  there exists $i \in I \cap J$  and $j \in I \setminus J$ with the property that $\cancCL{i}{j}{\treeA} = I$.
Accordingly, define 
%
\begin{align}
 \hspace{-1mm}Q\prl{I,J} &\sqz{\ldf} \! \crl{\prl{i,j}  \Big | i \sqz{\in} I \sqz{\cap} J, \; j \sqz{\in} I \sqz{\setminus} J, \; \cancCL{i}{j}{\treeA} \sqz{=} I }\!, \!\! 
\\
\hspace{-1mm}R\prl{I,J} &\sqz{\ldf} \! \crl{\prl{i,j}  \Big | i \sqz{\in} I \sqz{\cap} J, \; j \sqz{\in} J \sqz{\setminus} I, \; \cancCL{i}{j}{\treeB} \sqz{=} J }\!. \!\! \!
\end{align}
Note that if $\prl{i,j}  \in Q\prl{I, J} \cup R\prl{I,J}$, then
$i \neq j$.

Have $\indexset$ totally ordered (say, by enumerating its elements) and have $\indexset \times \indexset$ ordered lexicographically according to the order of $\indexset$.
Then,  define $q : \cluster{\treeA} \times  \cluster{\treeB}  \rightarrow \indexset \times \indexset$ to be 
%
\begin{align}
\hspace{-2mm}q\prl{I,J} \sqz{\ldf} 
\left \{ \begin{array}{@{}c@{}l@{}}
\prl{ \!\big. \min\prl{I\sqz{\cup} J}, \min\prl{I \sqz{\cup} J}\!} & \text{, if } I \sqz{\compatible} J,\\
\min Q\prl{I,J} & \text{, if } I \sqz{\not \compatible} J, \card{I} \sqz{\leq} \card{J}, \\
\min R\prl{I,J} & \text{, if } I \sqz{\not \compatible} J, \card{I} \sqz{>} \card{J}. 
\end{array} \right . \!\!\!
\end{align}
% 
Recall that  $Q\prl{I,J}$ and $R\prl{I,J}$ both contain pairs of distinct elements of $\indexset$. 
Hence,  $q$ satisfies the property \refeqn{it.q1} above.
 
By construction, for any $i\neq j$ we have:
%
\begin{align} \label{eq.qinverse}
q^{-1}\prl{i,j} \subseteq A\prl{i,j} \cup B\prl{i,j},
\end{align}
%
where
%
\begin{align}
A \prl{i,j} &\sqz{\ldf}  \left \{\prl{I,J}  \Big| I \sqz{\not \compatible} J, \; \card{I} \sqz{\leq} \card{J}, \;    \prl{i,j} \sqz{\in} Q\prl{I,J} \right \},
\\
B\prl{i,j} &\sqz{\ldf} \left \{ \prl{I,J}  \Big  | I \sqz{\not \compatible} J, \; \card{I} \sqz{\geq} \card{J}, \; \prl{i,j} \sqz{\in} R\prl{I, J} \right \}.
\end{align}
%
Remark that if $\prl{I,J} \in A\prl{i,j}$ then $\cancCL{i}{j}{\treeA} = I$ and $\cancCL{i}{j}{\treeB} \supsetneq J$. 
Hence,  if $\card{\cancCL{i}{j}{\treeA}} \geq \card{\cancCL{i}{j}{\treeB}}$, then $A\prl{i,j} = \emptyset$. 
Similarly, $\cancCL{i}{j}{\treeA} \supsetneq I$ and $\cancCL{i}{j}{\treeB} = J$ whenever $\prl{I,J} \in B\prl{i,j}$, and $B\prl{i,j} = \emptyset$ if $\card{\cancCL{i}{j}{\treeA}} \leq \card{\cancCL{i}{j}{\treeB}}$.
Thus, one can observe that   for any $i,j \in \indexset$,
\begin{align}
A\prl{i,j} \neq \emptyset \Longrightarrow B\prl{i,j} = \emptyset. \label{eq.incompatiblepairs}
\end{align}
% 


Recall that for any $i,j \in \indexset$ and $\prl{I,J} \in A\prl{i,j}$ we have:
%
\begin{align}
I \sqz{=} \cancCL{i}{j}{\treeA}, J \sqz{\subsetneq} \cancCL{i}{j}{\treeB},  \card{I}  \sqz{\leq} \card{J} \text{ and } J \sqz{\in} \ancestorCL{\crl{i}, \treeB} \!.\!\!
\end{align}
%
Hence,  one can conclude that
%
\begin{align}
\hspace{-1mm}\card{A\prl{i,j}} \leq \card{\cancCL{i}{j}{\treeB}} \sqz{-} \card{\cancCL{i}{j}{\treeA}}
= \prl{\mat{U}\prl{\treeB}_{ij} \sqz{-} \mat{U}\prl{\treeA}_{ij}}\!. \!\! 
\end{align}    
%
Similarly, for any $i,j \in \indexset$
%
\begin{align}
\hspace{-1mm}\card{B\prl{i,j}} \leq \card{\cancCL{i}{j}{\treeA}} \sqz{-} \card{\cancCL{i}{j}{\treeB}}
= \prl{\mat{U}\prl{\treeA}_{ij} \sqz{-} \mat{U}\prl{\treeB}_{ij}}\!. \!\! 
\end{align}    

%
Thus, overall, using \refeqn{eq.qinverse} and \refeqn{eq.incompatiblepairs}, one can obtain the second property of $q$ as follows: for any $i \neq j \in S$
%
\begin{align}
\card{q_{\treeA, \treeB}^{-1}\prl{i,j}} \sqz{\leq} \card{A\prl{i,j}} \sqz{+} \card{B\prl{i,j}} \sqz{\leq} \absval{\mat{U}\prl{\treeB}_{ij} \sqz{-} \mat{U}\prl{\treeA}_{ij}}\!,\!\!
\end{align}
%
which completes the proof.
\end{proof}
 
 






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Navigation in the Space of  Trees }
\label{sec.NavTreeSpace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


We now introduce an abstract discrete dynamical system in the NNI graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ of binary hierarchies over a fixed finite leaf set $\indexset$. 
First, we shall propose a new NNI control policy  to navigate toward any desired goal hierarchy $\treeB \in \bintreetopspace_{\indexset}$ from any arbitrary hierarchy $\treeA \in \bintreetopspace_{\indexset}$ with provable convergence guarantees. 
Next, we will introduce a new dissimilarity between a pair of trees based on  NNI navigation paths joining them. 



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{A Discrete-Time Dynamical System Perspective}
\label{sec.Dynamical}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Recall that in order to define a control policy for navigating in $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$, we need to construct an input bundle capturing all possible transitions (edges) in $\NNIgraph_{\indexset}$.
Let $\NNIDedge$ denote  the set of  \emph{directed} edges of the NNI graph,
%
\begin{align}\label{eq:InputBundle}
\hspace{-1mm}
\NNIDedge &\ldf 
\hspace{-2mm} \bigsqcup_{ \treeA \in \bintreetopspace_{\indexset}} \hspace{-1mm}\NNIDedge_{\treeA} = 
\hspace{-2mm}\bigcup_{\treeA \in \bintreetopspace_{\indexset}} \hspace{-2mm} \crl{\treeA} \times \NNIDedge_{\treeA}, \quad   \NNIDedge_{\treeA} \ldf   \grandchildset{\treeA} \cup \crl{\emptyset}\!. \!\!  
\end{align} 
%
Every directed edge in $\NNIDedge$ is referenced by a source tree and an associated grandchild in that tree.
Consequently, let $\NNI : \NNIDedge \rightarrow \bintreetopspace_{\indexset}$ denote the NNI move on a nondegenerate hierarchy $\treeA \in \bintreetopspace_{\indexset}$ at a grandchild cluster $G \in \NNIDedge_{\treeA}$.
%
%\begin{align}
%\treeC \ldf \NNI \prl{\treeA, G}. \label{eq:NNIoperator}
%\end{align}
%
Here, note that the NNI move at the empty cluster  corresponds to the  identity map in $\bintreetopspace_{\indexset}$, i.e. $\treeA = \NNI\prl{\treeA, \emptyset}$ for all $\treeA \in \bintreetopspace_{\indexset}$.
Therefore, the notion of identity map in $\bintreetopspace_{\indexset}$ slightly extends  the NNI graph by adding  self-loops at every vertex (it  is necessary for a discrete-time  dynamical system in $\bintreetopspace_{\indexset}$ to have  fixed points).

\bigskip

Accordingly, one can consider an abstract discrete-time dynamical system in  $\bintreetopspace_{\indexset}$ using NNI moves described as
%
\begin{subequations} \label{eq:SystemModel}
\begin{align}
\treeA^{k+1} &= \NNI\prl{\big. \treeA^k, G^k},  \label{eq:NNITransition}\\
 G^k &= \vectbf{u}(\treeA^k), \label{eq:NNIControl} 
\end{align}
\end{subequations}
%
where %$\NNI: \NNIDedge  \rightarrow \bintreetopspace_{\indexset}$ \refeqn{eq:NNIoperator} denotes the NNI move on $\treeA^k$ at  grandchild   $G^k \in \grandchildset{\treeA^k}$, and 
$\vectbf{u} $ is a control policy of  $\treeA^k \in \bintreetopspace_{\indexset}$  and returns a grandchild $G^k \in \NNIDedge_{\treeA^k}$. 
Abusing notation, we shall denote the closed-loop dynamical system as
\begin{align} \label{eq:CLSystemModel}
\treeA^{k+1} = \prl{\NNI \circ \vectbf{u}}\prl{\treeA^k}.% = \NNI\prl{\treeA^k, \vectbf{u}\prl{\treeA^k}}.
\end{align} 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Special Crossings of Clusters}
\label{sec.SpecialCrossings} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%We now introduce a particular set of cluster crossings used in the design of the NNI control law in \refsec{sec.NNIControl}.

\begin{definition}\label{def:CrossingSplits}
For any $\treeA,\treeB \in \bintreetopspace_{J}$, let $\CommonXSplits{\treeA,\treeB}$ denote the set of common clusters of $\treeA$ and $\treeB$ with crossing splits,
%
{
\begin{align}
\CommonXSplits{\treeA,\treeB} \!\sqz{\ldf}\! \crl{ \!\CommonXCL \sqz{\in} \cluster{\treeA} \sqz{\cap} \cluster{\treeB} \!\Big | \childCL{\CommonXCL,\treeA} \sqz{\neq} \childCL{\CommonXCL,\treeB} \!}\!\!.\!\! \! \label{eq:CrossingSplits}
\end{align}
}
\end{definition}
%
Note that two trees are distinct if and only if they have a common cluster with different splittings into children.  That is to say for any $\treeA, \treeB \in \bintreetopspace_{\indexset}$
%
\begin{align}
\treeA = \treeB \Longleftrightarrow \CommonXSplits{\treeA,\treeB} = \emptyset.
\end{align}
%
%Additionally, a pair of hierarchies $\treeA,\treeB \in \bintreetopspace_{\indexset}$  are disjoint if and only if $\CommonXSplits{\treeA,\treeB} = \crl{\indexset}$.

Let $\treeA, \treeB \in \bintreetopspace_{\indexset}$ be two distinct trees and $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$.
Note that every cluster $\II \in \cluster{\treeA} \setminus \descendantCL{\CommonXCL,\treeA}$  either contains $\CommonXCL$ or  is disjoint with $\CommonXCL$, and so $I$ is compatible with  $\childCL{\CommonXCL,\treeB}$.
Hence, any cluster $\II \in \cluster{\treeA}$ incompatible with $\childCL{\CommonXCL,\treeB}$ is always a descendant of $\CommonXCL$ in $\treeA$,  
%
%\begin{align}
%I \not \compatible \childCL{K,\treeB} \Rightarrow I \in \descendantCL{\CommonXCL,\treeA}, \;\; \forall I \in \cluster{\treeA}, 
%\end{align}
which motivates the following definition:
%
\begin{definition} \label{def:CLXSplitSet}
For  $\treeA \neq \treeB \in \bintreetopspace_{\indexset}$  and  $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$, let 
%$ \CLXSplitSet{\treeA,\treeB; \CommonXCL}$ denote the set of  clusters of $\treeA$  incompatible with  $\childCL{K,\treeB}$,
%
\begin{align}
\CLXSplitSet{\treeA,\treeB; \CommonXCL} \ldf \crl{ \CLXSplit \in \descendantCL{K,\treeA} \Big | \CLXSplit \not \compatible \childCL{K,\treeB}},
\label{eq:CLXSplitSet}
\end{align} 
%
and denote the subset of \emph{deep}  clusters incompatible with $\childCL{\CommonXCL,\treeB}$ as (see \reffig{fig:CrossingClusters})
%
\begin{align} 
\hspace{-1mm}\DeepXSplit{\treeA,\treeB; K} &\sqz{\ldf}  \left \{ \!  I \sqz{\in} \CLXSplitSet{\treeA,\treeB; K} \! \Big | \childCL{I,\treeA} \compatible \childCL{K,\treeB}, \right. \nonumber \\
& \hspace{27mm}\left. \Big. 
\childCL{\compLCL{I}{\treeA}, \treeA} \compatible \childCL{K,\treeB} \right\}\!. \!\! \label{eq.DeepXSplit}
\end{align}
\end{definition}
%
Note that $\CLXSplitSet{\treeA, \treeB; K}$ and $\DeepXSplit{\treeA,\treeB; K}$ are nonempty 
%\footnote{ One might consider a cluster incompatible with $\childCL{K,\treeB}$ at the maximal depth,
%%
%\begin{align}
%I = \arg \max_{J \in \CLXSplitSet{\treeA,\treeB; K}} \depth{\treeA}\prl{J},
%\end{align}  
%%
%and it is evident that $I \in \DeepXSplit{\treeA,\treeB; K}$.
%Alternatively, see  \reflem{lem:AncestorIncompatibility}.
%} 
since at least an element of $\childCL{K,\treeA}$ is incompatible with  $\childCL{K,\treeB}$, and vice versa,
which is evident from the following lemma: 

\begin{figure}[htb]
\centering
\includegraphics[width=0.49 \textwidth]{CrossingClusters.eps} 
\caption{An illustration of $\CLXSplitSet{\treeA,\treeB; K}$ and $\DeepXSplit{\treeA, \treeB; K}$ of $\treeA,\treeB \in \bintreetopspace_{\brl{9}}$, and $K = \brl{9} \in \CommonXSplits{\treeA;\treeB}$.
The vertices and edges associated with clusters of $\treeA$ incompatible with $\childCL{K,\treeB}$ are thickened.
The only deep cluster of $\treeA$ incompatible with $\childCL{K,\treeB}$ is $A = \crl{1,2}$ which is also Type 1.
$B$ and $\compLCL{B}{\treeA}$ are examples of Type 2 clusters incompatible with $\childCL{K,\treeB}$. 
}  \label{fig:CrossingClusters}
\end{figure}

\begin{lemma}\label{lem:SplitCompatibleEquivalence}
Let $\crl{\KK_L, \KK_R}$  be a bipartition  of set $\KK$ and  $\II \subsetneq \KK$. 
Then, the  following equivalences hold
%
\begin{align} \label{eq:SplitCompatibleEquivalence}
\II  \compatible \crl{\KK_L, \KK_R}
%
\Longleftrightarrow
%
\prl{\II  \subseteq \KK_L}  \logicor  
\prl{\II  \subseteq \KK_R} .
\end{align}
\end{lemma}
%
\begin{proof}
See \refapp{app:SplitCompatibleEquivalence}.
\end{proof}

\bigskip

Here is a useful application of \reflem{lem:SplitCompatibleEquivalence}: 

\begin{corollary} \label{cor:AncestorIncompatibility}
%
For any $\treeA \neq \treeB \in \bintreetopspace_{\indexset}$ and $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$, if $\CLXSplit \in \CLXSplitSet{\treeA,\treeB; \CommonXCL}$, then $\ancestorCL{\CLXSplit,\treeA} \cap \descendantCL{\CommonXCL,\treeA} \subseteq \CLXSplitSet{\treeA,\treeB; \CommonXCL}$. 
\end{corollary}
%



\begin{definition} \label{def:SingleJointIncompatibility}
For any $\treeA \neq \treeB \in \bintreetopspace_{\indexset}$ and $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$, a cluster $I \in \CLXSplitSet{\treeA,\treeB; \CommonXCL}$ is said to be \emph{Type 1 }  if  
$\compLCL{I}{\treeA} \compatible \childCL{\CommonXCL, \treeB}$,  and otherwise it is said to be \emph{Type 2} (see \reffig{fig:CrossingClusters}).
\end{definition}
%




Finally, we find it useful to remark a property of Type 2 incompatibilities:

\begin{lemma} \label{lem:JointIncompatibility}
Let  $\treeA \neq \treeB \in \bintreetopspace_{\indexset}$ and $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$.  
Siblings $\CLXSplit, \compLCL{\CLXSplit}{\treeA} \in \CLXSplitSet{\treeA,\treeB; \CommonXCL}$ are both Type 2 if and only if they are both incompatible with each child $D$ of $\CommonXCL$ in $\treeB$. That is to say, for any $I \in \descendantCL{K,\treeA}$ and $D \in \childCL{\CommonXCL,\treeB}$,
\begin{align}
\left \{
\begin{array}{c}
I \not \compatible \childCL{K,\treeB}, \\
\compLCL{I}{\treeA} \not  \compatible  \childCL{K,\treeB}
\end{array}
\right.
\Longleftrightarrow
\left\{ 
\begin{array}{c}
I \not \compatible D, \\
\compLCL{I}{\treeA} \not\compatible D.
\end{array}
\right.  
\end{align}
\end{lemma}
%
%
\begin{proof}
See \refapp{app:JointIncompatibility}.
\end{proof}
%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{NNI  Control Law} 
\label{sec.NNIControl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


To navigate from an arbitrary hierarchy $\treeA \in \bintreetopspace_{\indexset}$ towards any selected desired hierarchy $\treeB \in \bintreetopspace_{\indexset}$ in the NNI-graph,  we propose an NNI control policy $\vectbf{u}_{\treeB}$ that returns an NNI move on $\treeA$ at a grandchild $G \in \grandchildset{\treeA} \cup \crl{\emptyset}$, see \reffig{fig:NNIControlFlowchart}, as follows: 

\begin{enumerate}
\item If $\treeA = \treeB$, then just return the identity move,  $G = \emptyset$. 

\item Otherwise, 

\begin{enumerate}

\item Select a common cluster $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$ \refeqn{eq:CrossingSplits}.
% 
\item Find a deep  cluster $\CLXSplit \in \DeepXSplit{\treeA,\treeB; \CommonXCL}$ \refeqn{eq.DeepXSplit} incompatible with $\childCL{K,\treeB}$. 
%
\item Return a proper NNI navigation move  on $\treeA$ at  grandchild $G  \in \childCL{\CLXSplit, \treeA}$  selected as follows: 

\begin{enumerate}
\item If $ \compLCL{\CLXSplit}{\treeA} \compatible \childCL{\CommonXCL,\treeB}$ (Type 1, see \reffig{fig:DeepXSplit}(a)), 
then return $G \in \childCL{I,\treeA}$ with the property that $\compLCL{G}{\treeA}, \compLCL{I}{\treeA} \subset J$ for some $J \in \childCL{K,\treeB}$.


\item Otherwise (Type 2, see \reffig{fig:DeepXSplit}(b)), 
return an arbitrary NNI move at a child of $\CLXSplit$ in $\treeA$.
\end{enumerate}
\end{enumerate}
\end{enumerate}  
%
This NNI control law preserves common clusters of hierarchies. As a result, the navigation problem of trees can be divided into subproblems of disjoint trees which then may be solved in parallel. This is known as the decomposability property \cite{waterman_jtb1978}. 


\begin{figure}[htb]
\centering
\includegraphics[width=0.35\textwidth]{NNIControlFlowChart.eps} 
\caption{A flowchart of navigating from $\treeA \in \bintreetopspace_{\indexset}$ towards $\treeB \in \bintreetopspace_{\indexset}$ based on the NNI control law $\vectbf{u}_{\treeB}$.}
\label{fig:NNIControlFlowchart}
\end{figure}

In brief, our NNI control scheme  resolves incompatibilities between clusters of $\treeA$ and $\treeB$ level by level, depending on  the selected common cluster $\CommonXCL$  and one of its deep  clusters $\CLXSplit$ in Step 2.
More precisely, for a fixed $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$, the clusters of $\treeA$ incompatible  with  $\childCL{K,\treeB}$ are replaced by compatible ones  using NNI moves associated with deep clusters in $\DeepXSplit{\treeA,\treeB; \CommonXCL}$ in a bottom to top fashion. 
If desired, one can choose the highest common cluster, $K  = \argmin_{J \in \CommonXSplits{\treeA,\treeB}} \depth{\treeA}\prl{J} + \depth{\treeB}\prl{J}$ -- a  top-down strategy, to obtain common splits at higher levels first, yielding higher priority resolution of incompatibilities for   clusters closer to the root.
%
%\begin{remark} \label{rem.NNIControlCommonCL}
%For any initial and desired nondegenerate hierarchy $\treetop, \treetop^* \in \bintreetopspace_{\indexset}$, the NNI control policy $\vectbf{u}_{\treetop^*}$ preserves their common clusters.    
%\end{remark}
% 

By construction, the NNI control law $\vectbf{u}_{\treeB}$ is nondeterministic, and therefore generates multiple choices of paths from any given source $\treeA$ to the target $\treeB$. 
All such paths will be referred to as \emph{NNI navigation paths}.
We leave the making of systematic selections of $K$ and $I$ in step (2) to a future discussion of specific implementations of the control policy \cite{bryant_DIMACS2003, feragenEtAl_IPMI2012,chakerian_holmes_JCGS2012}. 
Here we only mean to focus on properties of this control scheme pertinent to its application as a means for constructing NNI navigation paths and computing their length: since any two NNI navigation paths joining a given pair of vertices turn out (\refthm{thm:NavPathLength}) to have equal lengths, the NNI control scheme gives rise to a new dissimilarity, $\distNav$, which we now proceed to.

%and so a resulting path, called an \emph{NNI navigation path}, from $\vectbf{u}_{\treeB}$ joining $\treeA$ to $\treeB$ is not necessarily unique. 
%We intentionally leave selections of $K \in \CommonXSplits{\treeA,\treeB}$ and $I \in \DeepXSplit{\treeA, \treeB; K}$ in Step 2 unspecified because this paper  mainly concentrates on tools for discriminative comparison of trees; for instance, the average length of all NNI navigation paths joining a pair of trees.  
%In particular, we shall demonstrate, in \refthm{thm:NavPathLength},  that the lengths of all NNI navigation paths  joining a pair of trees are  the same and define a positive-definite dissimilarity in $\bintreetopspace_{\indexset}$.
%Although, any deterministic version of the NNI control law  is beyond the scope of this paper,   the explicit form of paths  resulting from such a deterministic law might still have a significant value for consensus/average models and statistical analysis of trees \cite{bryant_DIMACS2003, feragenEtAl_IPMI2012,chakerian_holmes_JCGS2012}. 

A final remark related to the behaviour of the NNI control law at    deep clusters incompatible with $\childCL{K,\treeB}$ is:


\begin{figure}[htb]
\centering
\begin{tabular}{@{}c@{}}
\begin{tabular}{@{}c@{\hspace{5mm}}}
\includegraphics[width=0.1\textwidth]{CommonXCL.eps} \\
(a)
\end{tabular} 

\begin{tabular}{@{\hspace{5mm}}c@{}}
\includegraphics[width=0.25\textwidth]{SinglyIncompatible.eps} \\
 (b)
\end{tabular}
\\
\includegraphics[width=0.49\textwidth]{JointlyIncompatible.eps} 
\\(c)
\end{tabular}
\caption{An illustration of  deep  clusters incompatible with $\childCL{K, \treeB}$:  Type 1 (b) and  Type 2 (c) incompatibilities with $\childCL{K,\treeB}$ (a) of a common cluster $K \in \CommonXSplits{\treeA,\treeB}$, and the associated NNI navigation moves until resolving incompatibilities with  $\childCL{K,\treeB}$. 
Clusters are colored according to their inclusion relation, and the thickened vertices show a portion of incompatible clusters in $\CLXSplitSet{\treeA, \treeB; K}$.}
\label{fig:DeepXSplit}
\end{figure}




\begin{remark} \label{rem.NumberofNNIMoves}
Let $\treeA, \treeB \in \bintreetopspace_{\indexset}$ be two distinct trees, and $K \in \CommonXSplits{\treeA,\treeB}$ and $I \in \DeepXSplit{\treeA,\treeB; K}$ be the cluster selected by the NNI control law $\vectbf{u}_{\treeB}$.  
After a single NNI move, 
%
\begin{itemize}
\item If  $I$  is Type 1, $\vectbf{u}_{\treeB}$ replaces $I$  by a cluster compatible with $\childCL{K, \treeB}$ (see \reffig{fig:DeepXSplit}(a)).
\item If $I$ is  Type 2,  $\vectbf{u}_{\treeB}$ replaces $I$  by a Type 1 cluster incompatible with $\childCL{K,\treeB}$ and its sibling $\compLCL{I}{\treeA}$, a Type 2 cluster in $\DeepXSplit{\treeA,\treeB; K}$, becomes  Type 1 incompatible with $\childCL{K,\treeB}$ in the next hierarchy  (see \reffig{fig:DeepXSplit}(b)).
\end{itemize}
Meanwhile, the incompatibility type (Type 1, Type 2 or none) of the rest of clusters in $\cluster{\treeA} \setminus\crl{I, \compLCL{I}{\treeA}}$  are kept unchanged in the next hierarchy.   
\end{remark}

%\begin{remark} \label{rem.NumberofNNIMoves}
%Let $\treeA, \treeB \in \bintreetopspace_{\indexset}$ be two distinct trees and $K \in \CommonXSplits{\treeA,\treeB}$ with $\crl{K_L, K_R} = \childCL{K,\treeB}$.  
%The NNI control law $\vectbf{u}_{\treeB}$ replaces   any Type 1 cluster $I \in \DeepXSplit{\treeA,\treeB; K}$ of $\treeA$ by a cluster, which is either $\parentCL{I,\treeA} \cap K_L$ or $\parentCL{I,\treeA} \cap K_R$, compatible with $\childCL{K, \treeB}$  after a single NNI move (see \reffig{fig:DeepXSplit}(a)).
%On the other hand, after a single NNI move, $\vectbf{u}_{\treeB}$ replaces any Type 2 cluster
%$I \in \DeepXSplit{\treeA,\treeB; K}$ of $\treeA$ by a Type 1 cluster incompatible with $\childCL{K,\treeB}$ and its sibling $\compLCL{I}{\treeA}$, a Type 2 cluster in $\DeepXSplit{\treeA,\treeB; K}$, becomes  Type 1 incompatible with $\childCL{K,\treeB}$ in the next hierarchy.
%Hence a replacement of Type 2 clusters $I , \compLCL{I}{\treeA} \in \DeepXSplit{\treeA,\treeB;K}$ by clusters, $\parentCL{I,\treeA} \cap K_L$ and $\parentCL{I,\treeA} \cap K_R$, compatible with $\childCL{K,\treeB}$ requires three NNI moves (see \reffig{fig:DeepXSplit}(b)).   
%\end{remark}


\begin{proposition} \label{prop:NNIControlCost}
An output of the NNI control law $\vectbf{u}_{\treeB}$ to navigate in the NNI graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ towards a desired hierarchy $\treeB \in \bintreetopspace_{\indexset}$ can be obtained in $\bigO{\card{\indexset}}$ time. 
\end{proposition}
%
\begin{proof}
Let $\treeA \in \bintreetopspace_{\indexset}$. 
The common clusters and equality  of $\treeA$ and $\treeB$ can be determined in linear time, $\bigO{\card{\indexset}}$, using the algorithm in \cite{day_joc1985}.

If  $\treeA = \treeB$, then $\vectbf{u}_{\treeB}$ returns the identity move.
Otherwise, $\CommonXSplits{\treeA,\treeB} \neq \emptyset$ and, given  the common clusters of $\treeA$ and $\treeB$, a common cluster $K \in \CommonXSplits{\treeA,\treeB}$ with crossing splits  can be found in $\bigO{\card{\indexset}}$ time by  a traversal of $\treeA$.
Given $K \in \CommonXSplits{\treeA,\treeB}$, 
as discussed in the proof of \refprop{prop:CMdistanceCost}, the clusters of $\treeA$ incompatible with $\childCL{K,\treeB}$, i.e. $\CLXSplitSet{\treeA,\treeB; K}$, can be determined in $\bigO{\card{K}}$ time using \reflem{lem:SplitCompatibleEquivalence} and post-order traversal of subtree of $\treeA$ rooted at $K$. 
Given $\CLXSplitSet{\treeA,\treeB; K}$, a deep  cluster $I \in \DeepXSplit{\treeA, \treeB; K}$   and a proper NNI move on $\treeA$ at $G \in \childCL{I,\treeA}$ can be found in $\bigO{\card{K}}$ time by a  traversal of the subtree of $\treeA$ rooted at $K$.

Thus, the overall cost of computing the NNI control law $\vectbf{\treeB}$ is $\bigO{\card{\indexset}}$, which completes the proof.
\end{proof}

\bigskip
In order to find a path from any given vertex $\treeA \in \bintreetopspace_{\indexset}$ to $\treeB$ one simply obeys the controller $\vectbf{u}_{\treeB}$. 
The rest of this section is dedicated to discussing the termination time complexity of this algorithm. 



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Stability Properties}
\label{sec.Stability}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


For a desired nondegenerate hierarchy $\treeB \in \bintreetopspace_{\indexset}$ over a fixed finite label set $\indexset$, a candidate Lyapunov function \cite{khalil_2002} $V_{\treeB}: \bintreetopspace_{\indexset} \rightarrow \cl{\R}_{+}$   can be defined using the crossing matrix $\XMat$ \refeqn{eqn.XMat} as  
%
\begin{align}\label{eq:LyapunovCandidate}
V_{\treeB}\prl{\treeA} &\ldf \tr{\vectbf{p}}_{\treeA} \; \XMat\prl{\treeA,\treeB} \vectbf{p}_{\treeB}, \\
&= \sum_{\substack{I \in \cluster{\treeA} \\J \in \cluster{\treeB}}}   \frac{1}{ \hierconst^{\depth{\treeA}\prl{I}+\depth{\treeB}\prl{J}}} \indicatorfunc{I \not \compatible J}, 
\end{align}
%
where $\vectbf{p}_{\treeB} \in \R_{+}^{\prl{2\card{J}-1}\times 1}$ is the \emph{hierarchical attenuation vector} associated with $\treeB$,
%
\begin{align}
\vectbf{p}_{\treeB} \ldf \prl{\frac{1}{\hierconst^{\depth{\treeB}\prl{J}}}}_{J \in \cluster{\treeB}}.
\end{align}   
%
Here, $\hierconst \geq 1$ is a \emph{hierarchical attenuation constant} and $\lv_{\treeB}$ \refeqn{eq.Depth}  returns the level or depth of a cluster of $\treeB$. 
Note that since each nondegenerate hierarchy corresponds to a unique set of compatible clusters of maximum cardinality (\refrem{rem:MaximumCardinality}), it is clear that $V_{\treeB}\prl{\treeB} = 0$ and $V_{\treeB}\prl{\treeA} > 0$ for all $ \treeA \in \bintreetopspace_{\indexset} \setminus \crl{\treeB}$. 
Also, observe that  $V_{\treeB}\prl{\treeA}$ is a weighted version (a continuous one-parameter deformation) of $\dist_{CM}\prl{\treeA,\treeB}$ where equality holds for $\hierconst = 1$ \refeqn{eq.CMdistance}.

\bigskip

One can conclude that:

\begin{theorem} \label{thm.Stability}
The NNI control law $\vectbf{u}_{ \treeB}$  defines an abstract closed loop discrete dynamical system \refeqn{eq:CLSystemModel} in the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ on a fixed finite leaf set $\indexset$. 
There exist $\epsilon > 0$ such that for every $\hierconst \geq 10 + 4 \sqrt{5}$ and for any $\treeA \in \bintreetopspace_{\indexset} \setminus \crl{\treeB}$ one has
%
\begin{align}
V_{\treeB}\prl{\big. \prl{\NNI \circ \vectbf{u}_{\treeB}}\prl{\treeA}} - V_{\treeB}\prl{\treeA}< - \epsilon < 0.
\end{align}
%
Hence all paths generated by the control policy $\vectbf{u}_{\treeB}$ terminate at the goal, $\treeB$.
\end{theorem}
%
\begin{proof}
See \refapp{app.Stability}
\end{proof}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Tree Metrics and the NNI Control Law}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The NNI control law is compatible with $\distRF$ \refeqn{eq.RFdistance} and $\distCC$ \refeqn{eq.CCdistance}  in the sense that: 

\begin{proposition} \label{prop.Distance2Goal}
The Robinson-Foulds, $\distRF$ \refeqn{eq.RFdistance}, and cluster-cardinality, $\distCC$ \refeqn{eq.CCdistance},  distances  to any desired hierarchy $\treeB \in \bintreetopspace_{\indexset}$ are non-increasing at each evolution of the closed loop discrete dynamical system \refeqn{eq:CLSystemModel}  obeying the NNI control law $\vectbf{u}_{\treeB}$, i.e. for any $\dist \in \crl{\distRF, \distCC}$ and $\treeA \in \bintreetopspace_{\indexset}$
%
\begin{align}\label{eq.Distance2Goal}
\hspace{-1mm}\dist\prl{\big. \NNI \circ \vectbf{u}_{\treeB}\prl{\treeA}, \treeB} - \dist\prl{\treeA, \treeB}   \leq 0 .\!\!\! 
\end{align}
\end{proposition}
%
\begin{proof}
For $\distRF$, the result  is evident from that the NNI control law $\vectbf{u}_{\treeB}$ preserves the common clusters of the current and goal hierarchies.

\bigskip

For $\distCC$, the statement holds trivially for $\treeA = \treeB$.
If $\treeA \sqz{\neq} \treeB$, then let $K \in \CommonXSplits{\treeA,\treeB}$ with  $\crl{K_L, K_R} = \childCL{K,\treeB}$ and $I \in \DeepXSplit{\treeA,\treeB; K}$ be the selected  clusters by the NNI control law while determining the NNI move on $\treeA$ at $G \in \childCL{I,\treeA}$ yielding $\treeC = \prl{\NNI \circ \vectbf{u}_{\treeB}} \prl{\treeA}$. 
Note that this restructuring of $\treeA$ only changes relative relations of $G$, $\compLCL{G}{\treeA}$ and $\compLCL{I}{\treeA}$ below $P = \grandparentCL{G,\treeA} \subseteq K$. 
Further, by \refdef{def:SingleJointIncompatibility}, $G \subseteq K_A$ and $\compLCL{G}{\treeA} \subseteq K_B$ for some $A \neq B \in \crl{L,R}$, and so $\cancCL{i}{j}{\treeB} = K$ for any $i \in G$ and $j \in \compLCL{G}{\treeA}$.
Accordingly, the change in $\distCC$ with respect to $\treeB$ after the transition from $\treeA$ to $\treeC$ can be written as\footnotemark
%
{\small
\begin{align}
\distCC\prl{\treeC,\treeB} \sqz{-} \distCC\prl{\treeA,\treeB} & \sqz{=} \frac{1}{2}\!\norm{\!\mat{U}\prl{\treeC} \sqz{-} \mat{U}\prl{\treeB}\!} \sqz{-}  \frac{1}{2}\!\norm{ \!\big. \mat{U}\prl{\treeA} \sqz{-} \mat{U}\prl{\treeB}\!}\!,   \nonumber\\
%%%
& \hspace{-25mm} \sqz{=} \hspace{-1mm}\sum_{\substack{i \in G \\  j \in \compLCL{G}{\treeA}} } \hspace{-2mm}\absval{\mat{U}\prl{\treeC}_{ij} - \mat{U}\prl{\treeB}_{ij}} - \absval{\mat{U}\prl{\treeA}_{ij} - \mat{U}\prl{\treeB}_{ij}} \nonumber \\
%%%
& \hspace{-20mm} \sqz{+} \hspace{-1mm}\sum_{\substack{i \in G \\  j \in \compLCL{I}{\treeA}} } \hspace{-2mm} \absval{\mat{U}\prl{\treeC}_{ij} \sqz{-} \mat{U}\prl{\treeB}_{ij}} \sqz{-} \absval{\mat{U}\prl{\treeA}_{ij} \sqz{-} \mat{U}\prl{\treeB}_{ij}}  \nonumber \\
%%%
&\hspace{-20mm} \sqz{+} \hspace{-1mm}\sum_{\substack{i \in \compLCL{G}{\treeA} \\  j \in \compLCL{I}{\treeA}} } \hspace{-2mm} \absval{\mat{U}\prl{\treeC}_{ij} \sqz{-} \mat{U}\prl{\treeB}_{ij}} \sqz{-} \absval{\mat{U}\prl{\treeA}_{ij} \sqz{-} \mat{U}\prl{\treeB}_{ij}}\!,\!\!  \\
%%%
&\hspace{-25mm}\sqz{=} \hspace{-1mm}\sum_{\substack{i \in G \\  j \in \compLCL{G}{\treeA}} } \hspace{-2mm} \underbrace{\absval{\big. h(P) - h(K)} - \absval{\big. h(I) - h(K)}}_{= -h(P) + h(I) = -\card{\compLCL{I}{\treeA}}}  \nonumber \\
& \hspace{-20mm} \sqz{+} \hspace{-1mm}\sum_{\substack{i \in G \\  j \in \compLCL{I}{\treeA}} } \hspace{-0mm} \absval{ \big. h(P) \sqz{-} \mat{U}\prl{\treeB}_{ij}} \sqz{-} \absval{\big. h(P) \sqz{-} \mat{U}\prl{\treeB}_{ij}} \nonumber \\
&\hspace{-20mm} \sqz{+} \hspace{-1mm}\sum_{\substack{i \in \compLCL{G}{\treeA} \\  j \in \compLCL{I}{\treeA}} } \hspace{-1mm} \underbrace{\absval{h(\compLCL{G}{\treeA} \sqcup \compLCL{I}{\treeA}) \sqz{-} \mat{U}\prl{\treeB}_{ij}} \sqz{-} \absval{h(P) \sqz{-} \mat{U}\prl{\treeB}_{ij}}}_{\in \brl{h(\compLCL{G}{\treeA} \sqcup \compLCL{I}{\treeA}) - h(P), h(P) - h(\compLCL{G}{\treeA} \sqcup \compLCL{I}{\treeA})}=\brl{-\card{G},  \card{G}}}\!\!, \\
%%%
& \hspace{-25mm}\leq - \card{\Big. G}\card{\compLCL{G}{\treeA}} \card{\compLCL{I}{\treeA}} +  \card{\Big. G}\card{\compLCL{G}{\treeA}} \card{\compLCL{I}{\treeA}} = 0.
\end{align}
}
\footnotetext{Here, one can easily verify that $\distCC\prl{\treeC,\treeB} \sqz{-} \distCC\prl{\treeA,\treeB} < 0$ if $I$ is jointly incompatible with split $\childCL{K,\treeB}$.}
%

Note that  equality in \refeqn{eq.Distance2Goal} can hold for both $\distRF$ and $\distCC$ as illustrated in \reffig{fig:NNINavigationPath}. 
\end{proof}

\begin{figure}[htb]
\centering
\includegraphics[width=0.49\textwidth]{NNINavigationPath.eps} 
\caption{An NNI navigation path joining $\treeA$ to $\treeB$ and  associated NNI navigation moves. 
The NNI move from $\treeA$ to $\treeC = \prl{\NNI\circ\vectbf{u}_{\treeB}}\prl{\treeA}$  illustrates that $\distCC$ and $\distRF$ to the desired hierarchy $\treeB$ might stay the same after an NNI navigation transition. }
\label{fig:NNINavigationPath}
\end{figure}
\bigskip

%Like many tree rearrangement methods \cite{brown_day_JOC1984, li_tromp_zhang_jtb1996, owen_provan_tcbb2011,battaglieroetal_TCBB2010 }    with  the decomposability property \cite{waterman_jtb1978}, the NNI control law can be related to the RF distance as follows:
%%\vspace{-3mm}
%%
%\begin{lemma}\label{lem:RFDistanceNNIControl}
%The Robinson-Foulds distance $\distRF$ \refeqn{eq.RFdistance}  to any desired hierarchy $\treeB$ along all NNI navigation paths ending at $\treeB$ resulting from the NNI control law $\vectbf{u}_{\treeB}$ in \refsec{sec.NNIControl} is non-increasing, i.e. for all $\treeA \in \bintreetopspace_{\indexset}$
%%
%\begin{align}
%\hspace{-1mm}\distRF\prl{\NNI \circ \vectbf{u}_{\treeB} \prl{\treeA}, \treeB} - \distRF\prl{\treeA,\treeB} \leq 0. \!\!\!
%\end{align}
%\end{lemma}
%%
%\begin{proof} 
%The result is evident from that the NNI control law $\vectbf{u}_{\treeB}$ preserves the common clusters of the current and goal hierarchies.
%\end{proof}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The NNI Navigation Distance}
\label{sec.NavDistance}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{definition}
An \emph{ NNI navigation path}  from $\treeA \in \bintreetopspace_{\indexset}$ to $\treeB \in \bintreetopspace_{\indexset}$ is a path 
in the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ consistent with  the (nondeterministic) closed-loop dynamical system \refeqn{eq:CLSystemModel} obeying  the NNI control law $\vectbf{u}_{\treeB}$.

The \emph{NNI navigation distance} $\distNav\prl{\treeA,\treeB}$ between the trees $\treeA,\treeB$ is the length of an NNI navigation path joining them.
\end{definition}
%
Here we  prove (\refthm{thm:NavPathLength}) that all NNI navigation paths joining a pair of trees have the same length, which makes $\distNav$ into a well-defined dissimilarity on $\bintreetopspace_{\indexset}$.
Furthermore, we will provide an explicit expression for the NNI navigation distance, $\distNav$, and show that it can be computed in $\bigO{\card{\indexset}^2}$ time (\refprop{prop:distNavCost}). 






%We define an \emph{ NNI navigation path}  $\NavPath{\treeB}{\treeA}$ joining $\treeA \in \bintreetopspace_{\indexset}$ to $\treeB \in \bintreetopspace_{\indexset}$ to be a path 
%in the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$ resulting from  the closed-loop dynamical system \refeqn{eq:CLSystemModel} obeying  the NNI control law $\vectbf{u}_{\treeB}$. 
%Accordingly, the \emph{NNI navigation distance} $\distNav:\bintreetopspace_{\indexset}\times \bintreetopspace_{\indexset} \rightarrow \R$ between a pair of nondegenerate hierarchies $\treeA,\treeB \in \bintreetopspace_{\indexset}$ is defined to be the number of NNI moves along an NNI navigation path joining $\treeA $ to $\treeB$,
%%
%\begin{align}
%\distNav\prl{\treeA,\treeB} \ldf \card{\NavPath{\treeB}{\treeA}} - 1.
%\end{align}
%%
%Recall  that two distinct hierarchies $\treeA, \treeB \in \bintreetopspace_{\indexset}$ might have more than one common cluster $K \in \CommonXSplits{\treeA,\treeB}$ with crossing splits and the hierarchy $\treeA$ might have a number of deep clusters in $\DeepXSplit{\treeA,\treeB; K}$ incompatible with $\childCL{K,\treeB}$. 
%In such a case,  depending on application setting or in a random fashion, the NNI control law $\vectbf{u}_{\treeB}$ chooses one NNI move among many alternatives.
%As a result, an NNI navigation path $\NavPath{\treeB}{\treeA}$ joining $\treeA$ to $\treeB$ is not necessarily  unique. 
%On the other hand, the length of all NNI navigation paths joining $\treeA$ and $\treeB$ are the same as shown later in \reflem{lem:NavPathLength} and \reflem{lem:NavDistanceNotMetric}, and is equal to a weighted count of special crossings of $\treeA$ and $\treeB$ .
%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Resolving Incompatibilities with the Root Split}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Before stating the salient properties  of $\distNav$, we need to introduce some notation and lemmas. 
Let $\crl{\indexset_L,\indexset_R}$ be a bipartition of the leaf set $\indexset$, and $ \mathcal{BT}_{\crl{\indexset_L, \indexset_R}}$ denote the subset of $\bintreetopspace_{\indexset}$ containing nondegenerate hierarchies with the root split of $\crl{\indexset_L,\indexset_R}$,
%
\begin{align} \label{eq.GoalSet}
\bintreetopspace_{\crl{\indexset_L, \indexset_R}} \ldf \crl{\tree \in \bintreetopspace_{\indexset} \Big | \childCL{\indexset, \tree} = \crl{\indexset_L, \indexset_R}}.
\end{align}
%
Now, instead of the original problem of navigating from any $\treeA \in \bintreetopspace_{\indexset}$ towards a single desired hierarchy $\treeB \in \bintreetopspace_{\indexset}$  in the NNI-graph,  consider a related and simpler problem of navigating hierarchies towards the  set $\bintreetopspace_{\crl{\indexset_L, \indexset_R}}$.
One can easily observe that the NNI control law can be used to solve this new problem by  selecting any desired hierarchy $\treeB \in \bintreetopspace_{\crl{\indexset_L, \indexset_R}}$ and fixing the common cluster $K \in \CommonXSplits{\treeA,\treeB}$, in Step 2a of the NNI control policy, as $K = \indexset$. 
We denote this version of the NNI control policy by $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$. 

In general, for any bipartition  $\crl{M_L, M_R}$ of subset $M \subseteq \indexset$ let $\vectbf{u}_{\crl{M_L,M_R}, \indexset}$ be the local controller, whose domain is 
%
\begin{align}
\bintreetopspace_{M, \indexset} \ldf \crl{\treeA \in \bintreetopspace_{\indexset} \big | M \in \cluster{\treeA} },
\end{align}
%
that coincides with the NNI control law $\vectbf{\vectbf{u}}_{\treeB}$ for $\treeB \in \bintreetopspace_{M,\indexset}$ if for any $\treeA \in \bintreetopspace_{M,\indexset}$ the common cluster $K \in \CommonXSplits{\treeA,\treeB}$, selected by the NNI control policy in in Step 2a,  is fixed as $K = M$. 
Observe that $\vectbf{u}_{\crl{M_L,M_R}, \indexset}$ terminates at
%
\begin{align}
\bintreetopspace_{\crl{M_L,M_R}, \indexset} & \sqz{\ldf} \left \{ \treeA \sqz{\in} \bintreetopspace_{M, \indexset} \Big |   \big. \childCL{M,\treeA} \sqz{=} \crl{M_L,M_R} \!\right \} \!.\!\!
\end{align}
%
In fact, from a hybrid systems perspective, for any desired hierarchy $\treeB \in \bintreetopspace_{\indexset}$ the NNI control law $\vectbf{u}_{\treeB}$  consists of local controllers $\vectbf{u}_{\childCL{K,\treeB}, \indexset}$ associated with nonsingular clusters $K \in \cluster{\treeB}$.
For any hierarchy $\treeA \in \bintreetopspace_{\indexset} \setminus \crl{\treeB}$, by selecting $K \in \CommonXSplits{\treeA,\treeB}$, the NNI control law $\vectbf{u}_{\treeB}$ arbitrarily selects one, $\vectbf{u}_{\childCL{K,\treeB}, \indexset}$, of the local controllers $\crl{\Big. \vectbf{u}_{\childCL{J,\treeB}, \indexset}}_{\substack{J \in \cluster{\treeB} \\ \card{J} > 1}}$ whose domain contains $\treeA$. 


\bigskip

Here, a critical observation about where an NNI navigation path consistent with $\vectbf{u}_{\crl{\indexset_L, \indexset_R}}$   ends in $\bintreetopspace_{\crl{\indexset_L, \indexset_R}}$ is:
%
\begin{lemma} \label{lem:IntermediateHierarchy}
Let  $\treeA \in \bintreetopspace_{\indexset}$  and $\crl{\indexset_L,\indexset_R}$ be a bipartition of $\indexset$. 
The closed loop dynamical system \refeqn{eq:CLSystemModel} obeying the NNI control rule $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$ converges in finite time to the nondegenerate hierarchy  $\treeC \in \bintreetopspace_{\crl{\indexset_L,\indexset_R}}$ with cluster set
%
\begin{align}
\cluster{\treeC} = 
\cluster{\treeressym{\indexset_{L}}{\treeA}} 
\cup 
\crl{\indexset} 
\cup
\cluster{\treeressym{\indexset_{R}}{\treeA}}.
\end{align}
%
%where $\treeproj{(.)}$ \refeqn{eq:TreeProjection} denotes the tree projection onto a certain subset of $\indexset$.
\end{lemma}
%
\begin{proof}
If $\childCL{\indexset,\treeA} = \crl{\indexset_L, \indexset_R}$, then the results  directly holds with $\treeC = \treeA$.

Otherwise ($\treeA \not \in \bintreetopspace_{\crl{\indexset_L,\indexset_R}}$), let $\treeB \in \bintreetopspace_{\crl{\indexset_L,\indexset_R}}$ and $\II \in \DeepXSplit{\treeA,\treeB;\indexset}$ \refeqn{eq.DeepXSplit}  be the  deep cluster selected by the NNI control law $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$. 
Observe  from \refrem{rem.NumberofNNIMoves} (also see \reffig{fig:DeepXSplit}) that, after a certain number of proper NNI moves resulting from $\vectbf{u}_{\treeB}$, clusters $\II$ and  $\compLCL{\II}{\treeA}$ are replaced by $\parentCL{\II,\treeA} \cap \indexset_{L}$ and $ \parentCL{\II,\treeA} \cap \indexset_{R}$ while the rest of clusters of $\treeA$ are kept unchanged.
Also note that a cluster $J \in \cluster{\treeA}$ compatible with  $\crl{\indexset_{L}, \indexset_{R}} $  is a proper subset of either $\indexset_{L}$ or $\indexset_{R}$ (\reflem{lem:SplitCompatibleEquivalence}).  
Accordingly, one can conclude that $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$  successively replaces all  cluster of $\treeA$ incompatible with $\crl{\indexset_L, \indexset_R}$  as described above yielding a hierarchy $\treeC \in \bintreetopspace_{\indexset}$ with cluster set 
%
\begin{align}
\cluster{\treeC} &= \crl{\II \cap \indexset_{L} \Big | \II \in \cluster{\treeA},\; \II \cap \indexset_{L}   \neq \emptyset} 
 \cup \crl{\big. \indexset}  \nonumber \\
 & \hspace{15mm}\cup \crl{\II\cap \indexset_{R}\Big |     \II \in \cluster{\treeA}, \; \II\cap\indexset_{R} \neq \emptyset} , \\
&= \cluster{\treeressym{\indexset_{L}}{\treeA}} 
 \cup 
\crl{\big. \indexset} 
\cup
\cluster{\treeressym{\indexset_{R}}{\treeA}}.
\end{align} 
%

Finally, the finite time convergence of the system directly follows from \refthm{thm.Stability}, and this completes the proof.
\end{proof}

\bigskip 


An NNI navigation path  from $\treeA \in \bintreetopspace_{\indexset}$ to the set $\bintreetopspace_{\crl{\indexset_L, \indexset_R}}$ is not necessarily unique since $\vectbf{u}_{\crl{\indexset_L, \indexset_R}}$ is nondeterministic.  
However:%,  the lengths of all such paths are the same and are equal to a weighted count of special crossings of $\treeA$ with $\crl{\indexset_L, \indexset_R}$:

\begin{lemma}\label{lem.SplitNavLength}
For any bipartition  $\crl{\indexset_L, \indexset_R}$ of  $\indexset$, the lengths of all NNI navigation paths from $\treeA \in \bintreetopspace_{\indexset}$ to 
$\bintreetopspace_{\crl{\indexset_L, \indexset_R}}$\refeqn{eq.GoalSet} are the same, and the NNI navigation distance $\distNav\prl{\sqz{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}}$    is given by 
%
{
\begin{align}\label{eq:IntermediatePathLength}
\distNav\prl{\sqz{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}} %&= \hspace{-2mm} \sum_{I \in \cluster{\treetop}} \hspace{-2mm} \indicatorfunc{\big. I \sqz{\not \compatible} \crl{\indexset_L^*, \indexset_R^*}} \!\! \prl{\! 1 \sqz{+} \frac{1}{2}\indicatorfunc{\big. \complementLCL{I} \sqz{\not \compatible} \crl{\indexset_L^*, \indexset_R^*}\!\!}\!\!}\!, \label{eq:IntermediatePathLength1}\\
& \sqz{=} \sum_{I \in \cluster{\treeA}}\prl{\walkST \circ \sumST_{\treeA, \crl{\indexset_L, \indexset_R}}}\prl{I},
%&\sqz{=} \hspace{-2mm} \sum_{I \in \cluster{\treeA}}\hspace{-2mm} \walkSTfunc{\!\sum_{A \in \childCL{I,\treeA}} \hspace{-4mm} \indicatorfunc{\Big.\sqz{A \sqz{\not\compatible} \crl{\indexset_L, \indexset_R}}} \!\!\!}\!\!, \!\!
\end{align}
}
%
where $\sumST_{\treeA, \crl{\indexset_L, \indexset_R}}:\cluster{\treeA} \rightarrow \crl{0,1,2}$ returns the number of children of $I \in \cluster{\treeA}$ incompatible with $\crl{\indexset_L,\indexset_R}$, 
%
\begin{align} \label{eq:sumST1}
\sumST_{\treeA, \crl{\indexset_L, \indexset_R}} \prl{I} \ldf \sum_{A \in \childCL{I,\treeA}} \hspace{-4mm} \indicatorfunc{\Big.\sqz{A \sqz{\not\compatible} \crl{\indexset_L, \indexset_R}}}, 
\end{align}
%
and
 %$\walkSTfunc{x} = \frac{1}{2}\prl{x^2 + x}$
\begin{subequations} \label{eq.walkST}
\begin{align}
\walkST:\crl{0,1,2} &\rightarrow \crl{0,1,3}\\
      x &\mapsto \frac{1}{2}\prl{x^2 + x}
\end{align}
\end{subequations}
%
encodes the required number of NNI moves to replace children of $I$ incompatible with $\crl{\indexset_L, \indexset_R}$ (\refrem{rem.NumberofNNIMoves}).
\end{lemma}
%
\begin{proof} 
Proof by induction.
If $\treeA \in \bintreetopspace_{\crl{\indexset_L, \indexset_R}}$ (base case), the result simply follows.

Otherwise (induction), let $\crl{\treeA_0 = \treeA, \treeA_1, \treeA_2, \ldots, \treeA_k}$ be an NNI navigation path, consistent with the NNI  control law $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$, starting from $\treeA$ and ending at $\treeA_k \in \bintreetopspace_{\crl{\indexset_L, \indexset_R}}$ such that for all $0\leq i< k $ $\treeA_i \not \in \bintreetopspace_{\crl{\indexset_L, \indexset_R}}$.

Observe that $\prl{\treeA_1, \treeA_2, \ldots, \treeA_k}$ is also an NNI navigation path, consistent with the NNI  control law $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$, starting from  $\treeA$ and ending in $\bintreetopspace_{\crl{\indexset_L,\indexset_R}}$.

For any $\treeC \in \bintreetopspace_{\indexset}$ let $\alpha\prl{\treeC}$ and $\beta\prl{\treeC}$, respectively, denote the numbers of Type 1 and Type 2 clusters of $\treeC$ incompatible with $\crl{\indexset_L,\indexset_R}$.

Now suppose \refeqn{eq:IntermediatePathLength} holds, and so one can rewrite $\distNav\prl{\treeA_1, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}$ as 
\begin{align}
\distNav\prl{\treeA_1, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}} = \alpha\prl{\treeA_1} + \frac{3}{2}\beta\prl{\treeA_1}.
\end{align}
Hence,
\begin{align} \label{eq:SplitLength1}
\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}} = \alpha\prl{\treeA_1} + \frac{3}{2}\beta\prl{\treeA_1} + 1.
\end{align}

Let $I \in \cluster{\treeA}$ be the selected cluster by $\vectbf{u}_{\crl{\indexset_L,\indexset_R}}$ so that the NNI move on $\treeA$ at a child $G \in \childCL{I,\treeA}$ yields $\treeA_1$.
\begin{itemize}
\item \underline{Case 1:} If $I$ is Type 1 incompatible with $\crl{\indexset_L,\indexset_R}$, then using \refrem{rem.NumberofNNIMoves}, one can verify that
\begin{equation}
\alpha\prl{\treeA} = \alpha\prl{\treeA_1} +1, \text{ and } \; \beta\prl{\treeA} = \beta\prl{\treeA_1}.
\end{equation}
% 
As a result, \refeqn{eq:SplitLength1} yields
%
\begin{align}
\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}} = \alpha\prl{\treeA} + \frac{3}{2}\beta\prl{\treeA}.
\end{align}

\item \underline{Case 2:} If $I$ is Type 2 incompatible with $\crl{\indexset_L,\indexset_R}$, then similarly, using \refrem{rem.NumberofNNIMoves}, one can observe that
%
\begin{equation}
\alpha\prl{\treeA} = \alpha\prl{\treeA_1} - 2, \text{ and } \; \beta\prl{\treeA} = \beta\prl{\treeA_1} + 2,
\end{equation} 
%
and so \refeqn{eq:SplitLength1} becomes
\begin{align}
\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}} = \alpha\prl{\treeA} + \frac{3}{2}\beta\prl{\treeA}.
\end{align}
\end{itemize} 



Therefore, the result follows. 
\end{proof}

\begin{lemma}\label{lem:NavSplitDistanceCost}
For any bipartition $\crl{\indexset_L, \indexset_R}$ of $\indexset$ and $\treeA \in \bintreetopspace_{\indexset}$, the NNI navigation distance $\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}$ can be computed in linear time, $\bigO{\card{\indexset}}$. 
\end{lemma}
%
\begin{proof}
As discussed in the proof of \refprop{prop:CMdistanceCost}, all cluster compatibilities of $\treeA$  with  $\crl{\indexset_L, \indexset_R}$ can be determined in $\bigO{\card{\indexset}}$ time  using  \reflem{lem:SplitCompatibleEquivalence} and by a post order traversal of $\treeA$.
Therefore, the NNI navigation distance $\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}$ in \refeqn{eq:IntermediatePathLength} can be computed in $\bigO{\card{\indexset}}$ by a complete traversal of $\treeA$.
\end{proof}


\bigskip

Recall from \reflem{lem.SplitNavLength} that $\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}$ is a weighted count of cluster incompatibilities of $\treeA$ with $\crl{\indexset_L, \indexset_R}$. 
Hence,  a tight bound on $\dist_{Nav}\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}$ can be found using the maximal cluster incompatibilities of $\treeA$ with $\crl{\indexset_L, \indexset_R}$ as follows:

\begin{lemma} \label{lem:UpperBoundSplitNavPath}
Let  $\crl{\indexset_L, \indexset_R}$ be a  bipartition of $\indexset$  and  $\treeA \in \bintreetopspace_{\indexset}$.
The NNI navigation distance $\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L,\indexset_R}}}$  \refeqn{eq:IntermediatePathLength}  is tightly bounded from above as
%
\begin{align}
	\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L,\indexset_R}}}  \leq \card{\indexset} \sqz{+} \min  \prl{\card{\indexset_L}, \card{\indexset_R}} \sqz{-} 3, \!\! \label{eq:UpperBoundSplitNavPath}
\end{align}
%
where the  numbers of clusters of $\treeA$ incompatible with $\crl{\indexset_L, \indexset_R}$ is at most $\card{\indexset} - 2$ and the number of  clusters of $\treeA$  both of whose children are incompatible with $\crl{\indexset_L, \indexset_R}$   is at most $\min  \prl{\card{\indexset_L}, \card{\indexset_R}} \sqz{-} 1$. 
\end{lemma}
%
\begin{proof}
One can easily observe from \refeqn{eq:IntermediatePathLength} that the NNI navigation distance $\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L,\indexset_R}}}$ is maximized if all nontrivial  clusters of $\treeA$  are incompatible with $\crl{\indexset_L,\indexset_R}$ and the number of cluster siblings incompatible with $\crl{\indexset_L, \indexset_R}$ is maximized. 

Recall that the number of nontrivial clusters  of a nondegenerate hierarchy $\treeA \in \bintreetopspace_{\indexset}$ is $\card{\indexset} - 2$  (\refrem{rem:MaximumCardinality}). %\cite{robinson_jct1971, arslanEtAl_Allerton2012}.
Hence, the maximum number of clusters of $\treeA$ incompatible with $\crl{\indexset_L,\indexset_R}$ is   $\card{\indexset} - 2$.

Now, consider the set of clusters of  $\treeA$ whose children are  incompatible with $\crl{\indexset_L, \indexset_R}$,
%
\begin{align}
\hspace{-2.5mm}\mathcal{J}_{\crl{\indexset_L, \indexset_R}}\prl{\treeA} \! \sqz{\ldf} \! \crl{\! I \sqz{\in} \cluster{\treeA} \!\Big | \forall D \sqz{\in} \childCL{I,\treeA}\!, D \sqz{\not \compatible} \crl{\indexset_L, \indexset_R}\!\!}\!.\!\!\!
\end{align}
%
Let  $\II \in \mathcal{J}_{\crl{\indexset_L, \indexset_R}}\prl{\treeA}$. 
Recall from \reflem{lem:JointIncompatibility} that $D \cap F \neq \emptyset $ for all $D \in \childCL{\II, \treeA}$ and $F \in \crl{\indexset_L,\indexset_R} $. 
Hence, such a cluster $I \in \mathcal{J}_{\crl{\indexset_L, \indexset_R}}\prl{\treeA}$ with the minimal cardinality requires two elements from each block of  $\crl{\indexset_L,\indexset_R}$, and any other cluster $A \in \mathcal{J}_{\crl{\indexset_L, \indexset_R}}\prl{\treeA}$ requires at least  one  extra leaf label from each block of  $\crl{\indexset_L,\indexset_R}$ not contained in $I$. %depending on being either the parent of  or  disjoint with cluster $I$, respectively.  
By successive application of this argument, one can easily observe that $\card{\mathcal{J}_{\crl{\indexset_L, \indexset_R}}\prl{\treeA}} \leq \min \prl{\card{\indexset_L}, \card{\indexset_R}}-1$.

As a result, an upper bound on \refeqn{eq:IntermediatePathLength} can be obtained as
%
\begin{align}
\hspace{-2mm}	\dist_{Nav}\prl{\sqz{\treeA, \bintreetopspace_{\crl{\indexset_L,\indexset_R}}}}  \sqz{\leq}  \hspace{-6mm}\underbrace{\card{\indexset} - 2}_{\substack{\text{maximum number of}\\ \text{clusters incompatible} \\ \text{with $\crl{\indexset_L, \indexset_R}$} }} \hspace{-5mm}+ \hspace{2mm} \underbrace{\min  \prl{\card{\indexset_L}, \card{\indexset_R}} \sqz{-} 1}_{\substack{\text{maximum number of}\\ \text{cluster siblings} \\
\text{incompatible with $\crl{\indexset_L, \indexset_R}$} }} \hspace{-2mm}\!.\! \!\!
\end{align}
% 

One can  easily verify that this upper bound is actually tight using the hierarchies $\treeA, \treeB \in \bintreetopspace_{\brl{n}}$ 
in \reffig{fig.distCMdistNavDiameter} and the bipartition $ \crl{\indexset_L, \indexset_R}= \childCL{\brl{n}, \treeB} =\crl{\crl{1},\crl{2,3, \ldots, n}}$, where $\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L,\indexset_R}}}  = n-2$.
\end{proof}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Properties of the NNI Navigation Distance}
\label{sec:distNavProperty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

We now introduce a version of the crossing matrix $\XMat$ \refeqn{eqn.XMat} encoding weighted special cluster crossings between trees, which will be shown to have a significant connection with $\distNav$  later in \refthm{thm:NavPathLength}. 

\begin{definition}
The special crossing matrix $\mat{S}\prl{\treeA,\treeB}$ of a pair of hierarchies $\treeA,\treeB \in \treetopspace_{\indexset}$ is defined to be
%
\begin{align}\label{eq.SMat}
\mat{S}\prl{\treeA,\treeB}_{I,J} \ldf \prl{\walkST \circ \sumST_{\treeA,\treeB}}\prl{ I, J},
\end{align}
%
where  
$\sumST_{\treeA,\treeB}:\cluster{\treeA} \times \cluster{\treeB} \rightarrow \R$  counts the number of restricted crossings of children of cluster $I$ in $\treeA$ with children of cluster $J$ in   $\treeB$,
%
\begin{align} \label{eq.sumST2}
\sumST_{\treeA,\treeB}\prl{I,J} \ldf \sum_{A \in \treeressym{J}{\childCL{I,\treeA}}} \indicatorfunc{\big. A \not \compatible \treeressym{I}{\childCL{J,\treeB} }},
\end{align}
% 
where $\treeressym{J}{\childCL{I,\treeA}}$ denotes the restriction of $\childCL{I,\treeA}$ on $J$ (\refdef{def:TreeRestriction}), and $\walkST:\R \rightarrow \R$   is as defined in (\ref{eq.walkST}b).
\end{definition}


Recall that an NNI navigation path  joining $\treeA, \treeB \in \bintreetopspace_{\indexset}$ might not be unique since the NNI control law in \refsec{sec.NNIControl} is nondeterministic.
However:


\begin{theorem} \label{thm:NavPathLength}
The length of all NNI navigation paths  joining $\treeA, \treeB \in \bintreetopspace_{\indexset}$ are the same and the NNI navigation distance $\distNav\prl{\treeA,\treeB}$  between $\treeA$ and $\treeB$  is given by\footnote{Note that  $\distNav\prl{\treeA, \treeB}$ is always zero for $\card{J}= 2$, which is the base case of the recursion. 
For any $I \subseteq\indexset$ with $\card{I} = 1$ we trivially set   $\distNav\prl{\treeressym{I}{\treeA}, \treeressym{I}{\treeB}}  = 0$ . }
%
{\small
\begin{subequations} \label{eq:NavPathLength}
\begin{align}
\distNav\prl{\treeA,\treeB} &= \dist_{Nav}\prl{\treeA,\bintreetopspace_{\childCL{\indexset,\treeB}}}
\sqz{+}
\distNav\prl{\treeressym{\indexset_L}{\treeA},\treeressym{\indexset_L}{\treeB}} \nonumber\\
& \hspace{25mm} \sqz{+} \distNav\prl{\treeressym{\indexset_R}{\treeA},\treeressym{\indexset_R}{\treeB}}, \label{eq:NavPathLength1} \\
%& \hspace{-2mm}= \hspace{-2mm}\sum_{\substack{I^* \in \cluster{\treetop^*}\\I \in \cluster{ \treeressym{I^*}{\treetop}}}} \hspace{-3mm} \walkSTfunc{\sum_{A \in \childCL{I,\treeressym{I^*}{\treetop}}} \hspace{-3mm}\indicatorfunc{ A \not \compatible \childCL{I^*,\treetop^*}}\!\!}, \label{eq:NavPathLength2}\\
%&\hspace{-2mm}=\hspace{-2mm}\sum_{\substack{I \in  \cluster{\treetop}\\ I^* \in \cluster{\treetop^*}}}  \prl{\walkST \circ \sumST}\prl{\treetop^*,\treetop; I^*, I}  = \distNav\prl{\treetop^*, \treetop},\\
&\hspace{0mm}=\hspace{0mm} \norm{\mat{S}\prl{\treeA,\treeB}}_1
 \label{eq:NavPathLength3}
\end{align}
\end{subequations}
}
%
where $\crl{\indexset_L, \indexset_R} = \childCL{ \indexset,\treeB}$. 
Here, $\distNav\prl{\treeA, \bintreetopspace_{\childCL{\indexset,\treeB}}}$ \refeqn{eq:IntermediatePathLength} denotes the NNI navigation distance of $\treeA$ to  $\bintreetopspace_{\childCL{\indexset,\treeB}}$ \refeqn{eq.GoalSet} and $\mat{S}\prl{\treeA,\treeB}$\refeqn{eq.SMat} is the special crossing matrix of $\treeA$ and $\treeB$.  
\end{theorem}
%
\begin{proof}
See \refapp{app:NavPathLength}.
\end{proof}

\bigskip

Now, one might wonder if $\distNav$ \refeqn{eq:NavPathLength}  defines a dissimilarity measure in $\bintreetopspace_{\indexset}$, and may be a metric. 

\begin{lemma} \label{lem:NavDistanceNotMetric}
The NNI navigation distance $\distNav\prl{\treeA,\treeB} $ between any pair of nondegenerate hierarchies $\treeA,\treeB \in \bintreetopspace_{\indexset}$ is positive definite and symmetric, but it does not define a metric. 
\end{lemma}
%
\begin{proof}
By definition, $\distNav$ positive definite  
and  symmetry. In addition to \refcor{cor.CMdistanceNotMetric}, see the counter example in \reffig{fig:CMatNormNavLengthNotMetric} for $\dist_{Nav}$ being a metric.
\end{proof}

\begin{proposition}\label{prop:distNavCost}
The NNI navigation distance $\distNav$ in $\bintreetopspace_{\indexset}$ is computable in $\bigO{\card{\indexset}^2}$ time.
\end{proposition}
%
\begin{proof}
The result can be easily seen from the recursive expression of $\distNav$ \refeqn{eq:NavPathLength1} and \reflem{lem:NavSplitDistanceCost}.

Let $\treeA,\treeB \in \bintreetopspace_{\indexset}$ and $\crl{\indexset_L, \indexset_R} = \childCL{\indexset,\treeB}$. 
The recursion in \refeqn{eq:NavPathLength1} requires $\distNav\prl{\treeA, \bintreetopspace_{\childCL{\indexset, \treeB}}}$, which can be obtained in $\bigO{\card{\indexset}}$ time (\reflem{lem:NavSplitDistanceCost}), and the restrictions of $\treeA$ to $\indexset_L$ and $\indexset_R$, which can be computable by post-order traversal of $\treeA$ in linear time, $\bigO{\card{\indexset}}$.
Hence, $\distNav$ \refeqn{eq:NavPathLength1} requires a complete (depth-first) traversal of $\treeB$ each of whose iteration costs linear time with the number of leaves. 
Thus, the recursive computation of $\distNav$ costs $\bigO{\card{\indexset}^2}$ time.  
Also note that the special crossing matrix $\mat{S}\prl{\treeA,\treeB}$ \refeqn{eq.SMat} can be obtained with the same cost, $\bigO{\card{\indexset}^2}$ using a similar construction to the crossing matrix $\XMat\prl{\treeA,\treeB}$ \refeqn{eqn.XMat} in the proof of \refprop{prop:CMdistanceCost}.
\end{proof}




\begin{proposition} \label{prop:NavDistDiameter}

The diameter $\diam{\bintreetopspace_{\indexset}, \distNav}$ \refeqn{eq.diameter} of $\bintreetopspace_{\indexset}$  in the NNI navigation distance $\distNav$ \refeqn{eq:NavPathLength} is
%
\begin{align}\label{eq:NavDistDiameter}
\diam{\bintreetopspace_{\indexset}, \distNav} = \frac{1}{2} \prl{\card{\indexset} - 1} \prl{ \card{\indexset}  -2}. % =\sum_{i=2}^{\card{\indexset} } \prl{\card{\indexset} -  i}
\end{align} 
\end{proposition}
%
\begin{proof}
For $\card{\indexset} = 2$, $\distNav$ is always  zero since $\card{\bintreetopspace_{\brl{2}}} = 1$, and so \refeqn{eq:NavDistDiameter} holds. 

For $\card{\indexset}\geq 3$, let $\treeA,\treeB \in \bintreetopspace_{\indexset}$. 
Using the recursive formula of $\distNav$ in \refeqn{eq:NavPathLength1}, we can verify the result as follows
%
{\small
\begin{align}
\distNav\prl{\treeA,\treeB}  
%
&= \underbrace{\distNav\prl{\treeA, \bintreetopspace_{\childCL{\indexset,\treeB}}}}_{ \substack{\text{by \reflem{lem:UpperBoundSplitNavPath}} \\ \leq \card{\indexset}+ \min \prl{\card{\indexset_L}, \card{\indexset_R}}-3} } 
+ \underbrace{ \distNav\prl{\treeressym{\indexset_L}{\treeA},\treeressym{\indexset_L}{\treeB}}}_{\leq \frac{1}{2}\prl{ \card{\indexset_L} - 1} \prl{ \card{\indexset_L} -2}}  \nonumber \\
& \hspace{25mm}+ \underbrace{\distNav\prl{\treeressym{\indexset_R}{\treeA}, \treeressym{\indexset_R}{\treeB}}}_{\leq \frac{1}{2}\prl{ \card{\indexset_R} - 1} \prl{  \card{\indexset_R} -2} }, \\ 
%
& \hspace{-15mm}\leq \frac{1}{2}\prl{\card{\indexset_L}^2 \sqz{+} \card{\indexset_R}^2} \sqz{-} \frac{3}{2}\underbrace{\prl{\card{\indexset_L} \sqz{+} \card{\indexset_R}}}_{\card{\indexset}} \sqz{+} \card{\indexset} \sqz{+} \min \prl{\card{\indexset_L}, \card{\indexset_R}} \sqz{-} 1, \\
%
& \hspace{-15mm}= \frac{1}{2}\bigg (\!\card{\indexset}^2 - \hspace{-12mm} \underbrace{2\card{\indexset_L}\card{\indexset_R}}_{ =\min \prl{\card{\indexset_L}, \card{\indexset_R}} \prl{\card{\indexset} \sqz{-} \min \prl{\card{\indexset_L}, \card{\indexset_R}}}
} \hspace{-14mm}\bigg) \sqz{-} \frac{1}{2}\card{\indexset} \sqz{+} \min \prl{\card{\indexset_L}, \card{\indexset_R}} \sqz{-} 1, \!\!\\
%
&\hspace{-15mm}= \frac{1}{2} \prl{\card{\indexset}-1} \prl{ \card{\indexset} - 2} + \underbrace{\prl{\big. 1 - \min \prl{\card{\indexset_L}, \card{\indexset_R}}} \prl{\card{\indexset} -1}}_{\leq 0, \;\; \forall \card{\indexset} \geq 1},\\
&\hspace{-15mm}\leq \frac{1}{2} \prl{\card{\indexset}-1} \prl{ \card{\indexset} - 2}, 
\end{align}
} 
%
where $\crl{\indexset_L,\indexset_R} = \childCL{\indexset, \treeB}$. 
Here, recall that we set $\distNav\prl{\treeressym{I}{\treeA},\treeressym{I}{\treeB}} = 0$ for any $I \subset \indexset$ with $\card{I} = 1$.

One can easily observe that this upper bound is tight by considering the trees in \reffig{fig.distCMdistNavDiameter}. 
%since the length of NNI navigation path between caterpillar (linear) trees with reversely ordered leaves, e.g. in Newark format \cite{felsenstein2004} $\treetop = (((\ldots(((1,2),3)4), \ldots),n-1), n)$ and $\treetop = (((\ldots(((n,n-1),n-2)n-3), \ldots),2), 1)$,  requires exactly $\frac{1}{2} \prl{\card{\indexset}-1} \prl{ \card{\indexset} - 2}$ NNI transitions. 
\end{proof}

\bigskip




Although $\distNav$ is not a true metric, like $\distCM$ (\refprop{prop:CM_RF_bound}), it can be tightly bounded from below and above in terms of $\distRF$ as follows:

\begin{proposition} \label{prop:Nav_RF_bound}
For any $\treeA,\treeB \in \bintreetopspace_{\indexset}$,
%
\begin{align} \label{eq.NavPathRFbounds}
\hspace{-1mm}\distRF\prl{\treeA,\treeB} 
\sqz{\leq} 
\distNav\prl{\treeA,\treeB} 
\sqz{\leq} 
\frac{1}{2}\distRF\prl{\treeA,\treeB}^2 \sqz{+} \frac{1}{2}\distRF\prl{\treeA,\treeB}\!, \!\!\!
\end{align}
%
where both bounds are tight.
\end{proposition}
%
\begin{proof}
The lower bound simply follows from the construction of $\distNav\prl{\treeA,\treeB}$ since, by \refdef{def:NNIMove}, an NNI move on a hierarchy can only replace one cluster at a time. 
Hence, replacements of all unshared clusters take a number of NNI moves at least as much as the number of uncommon clusters, which is the Robinson-Foulds distance. 
The tightness of the bound is simply evident from
%
\begin{align}
\hspace{-1mm}\distRF\prl{\treeA,\treeB} \sqz{=} 1 
\Leftrightarrow 
\dist_{NNI}\prl{\treeA,\treeB} \sqz{=} 1 
\Leftrightarrow 
\distNav\prl{\treeA,\treeB} \sqz{=} 1 , \!\!\!
\end{align}  
%
for any $\treeA,\treeB \in \bintreetopspace_{\indexset}$.

If $\treeA$ and $\treeB$ have no nontrivial common clusters, then $\distRF\prl{\treeA,\treeB} = \card{\indexset} - 2$ and the result follows from  \refprop{prop:NavDistDiameter}.
Otherwise, to prove the upper bound in \refeqn{eq.NavPathRFbounds}, we shall use an induction. 
The result clearly holds for $\card{\indexset} = 2$. 
For $\card{\indexset} \geq 3$, let $I \in \cluster{\treeA} \cap \cluster{\treeB}$  be a nontrivial common cluster such that we split $\treeA$ and $\treeB$  just above $I$ yielding subtrees $\treeA_I = \treeressym{I}{\treeA}$ and $\treeB_I = \treeressym{I}{\treeB}$. 
Let $\treeA_{\neg I}$ and $\treeB_{\neg I}$, respectively, denote the remaining parts of $\treeA$ and $\treeB$ after pruning subtrees rooted at cluster $I$  and  each of them contains  a new leaf as a representative of associated pruned subtree.
 
Since the NNI control law preserves the common edges, the length of the NNI navigation path can be written as
%
\begin{align} \label{eq.NavPathTreeCut}
\distNav\prl{\treeA,\treeB} = \distNav\prl{\treeA_{I}, \treeB_{I}} + \distNav\prl{\treeA_{\neg I}, \treeB_{\neg I}}.
\end{align}
% 
Similarly, we have
%
\begin{align} \label{eq.RFTreeCut}
\distRF\prl{\treeA,\treeB} = \distRF\prl{\treeA_{I}, \treeB_{I}} + \distRF\prl{\treeA_{\neg I}, \treeB_{\neg I}}.
\end{align} 


Let $\alpha = \distRF\prl{\treeA_{I},\treeB_{I}}$ and $\beta= \distRF\prl{\treeA_{\neg I}, \treeB_{\neg I}}$, and so $\distRF\prl{\treeA,\treeB} = \alpha+\beta$. 
Suppose that
%
\begin{align}
\distNav\prl{\treeA_{I},\treeB_{I}} &\leq \frac{1}{2} \alpha \prl{\alpha +1}, \\
\distNav\prl{\treeA_{\neg I}, \treeB_{\neg I}} &\leq \frac{1}{2} \beta \prl{\beta +1}.
\end{align}  
%
It is evident from  \refeqn{eq.NavPathTreeCut} that
%
\begin{align}
\distNav\prl{\treeA,\treeB} &\leq \frac{1}{2} \alpha \prl{\alpha +1} + \frac{1}{2} \beta \prl{\beta +1}, \\
& \leq \frac{1}{2}\prl{\alpha + \beta}\prl{\alpha + \beta + 1}, \\
& = \frac{1}{2}\distRF\prl{\treeA,\treeB} \prl{\distRF\prl{\treeA,\treeB} + 1}.
\end{align}
%
This is also a tight upper bound due to \refprop{prop:NavDistDiameter}. 
Thus, the lemma follows.  
\end{proof}

\bigskip

Alternatively, $\distNav$ can be bounded from above by the dissimilarity measure $\distCM$ \refeqn{eq.CMdistance} counting the pairwise cluster crossings of trees: 

\begin{proposition} \label{prop:Nav_CM_bound}
For any $\treeA, \treeB \in \bintreetopspace_{\indexset}$, 
%
\begin{align}
\distNav\prl{\treeA,\treeB} \leq \frac{3}{2}\distCM\prl{\treeA,\treeB}.
\end{align}
\end{proposition}
%
\begin{proof}
Consider the closed form expression of $\distNav$ \refeqn{eq:NavPathLength3} in terms of the special crossing matrix $\mat{S}\prl{\treeA,\treeB}$ \refeqn{eq.SMat},
%
\begin{align}
\distNav\prl{\treeA,\treeB} \sqz{=} \norm{\mat{S}\prl{\treeA,\treeB}}_1 
\sqz{=} \hspace{-1mm}\sum_{\substack{I \in \cluster{\treeA}\\J \in \cluster{\treeB}}} \hspace{-2mm}\prl{\walkST \circ \sumST_{\treeA,\treeB}}\prl{I,J}.
\end{align}
%
Note that $\sumST_{\treeA,\treeB}\prl{I,J} \in \crl{0,1,2}$ for all nondegenerate trees in $\bintreetopspace_{\indexset}$, and $\walkST\prl{x} = \frac{1}{2}x^2 + \frac{1}{2}x \leq \frac{3}{2}x$ for all $x \in \brl{0,2}$. 
Hence, $\distNav$ can be bounded from above as
%
\begin{align}
\distNav\prl{\treeA,\treeB} &\sqz{\leq} \frac{3}{2}\sum_{\substack{I \in \cluster{\treeA}\\J \in \cluster{\treeB}}} \sumST_{\treeA,\treeB}\prl{I,J}, \\
%
& \hspace{-10mm}\sqz{=} \frac{3}{2}\hspace{-1mm}\sum_{\substack{I \in \cluster{\treeA}\\J \in \cluster{\treeB}}} \hspace{-1mm}\sum_{A \in \treeressym{J}{\childCL{I,\treeA}} } \hspace{0mm} \underbrace{\indicatorfunc{A \not \compatible \treeressym{I}{\childCL{J,\treeB}}}}_{\leq \underset{B \in \treeressym{I}{\childCL{J,\treeB}} }{\sum} \hspace{-5mm}\indicatorfunc{A \not \compatible B}}\!, \!\!\!\\
%
&\hspace{-10mm}\sqz{\leq} \frac{3}{2}\sum_{\substack{I \in \cluster{\treeA} \\ J \in \cluster{\treeB}}} \hspace{-3mm} \indicatorfunc{\!\!\Big.\prl{\big.I \sqz{\cap} \parentCL{J,\treeB}} \not\compatible \prl{\big.J \sqz{\cap} \parentCL{I,\treeA}}\!\!}\!.\!\! \label{eq.NavDistUpperBound}
\end{align}  

Now, let $A,B,C$ be sets with $B \subseteq C$, then one can easily observe that
\begin{align}
   A \compatible B  \Longrightarrow \prl{A \cap C} \compatible B, \label{eq.RestrictedComp}
\end{align}
%
but the reverse is not necessarily  true since $A \cap C \subseteq B$ does not imply $A \subseteq B$. In other words,
\begin{align}
\indicatorfunc{A \compatible B} \leq \indicatorfunc{\prl{A \cap C} \compatible B}.
\end{align} 

 
Thus, using the contra-positive of \refeqn{eq.RestrictedComp}, one can rewrite the upper bound \refeqn{eq.NavDistUpperBound} on $\distNav$ as
\begin{align}
\distNav\prl{\treeA,\treeB} &\leq \frac{3}{2} \sum_{\substack{I \in \cluster{\treeA}\\ J \in \cluster{\treeB}}} \indicatorfunc{I \not \compatible J} = \frac{3}{2} \norm{\XMat\prl{\treeA,\treeB}}_1, \\
&= \frac{3}{2} \dist_{CM}\prl{\treeA,\treeB},
\end{align}
%
which completes the proof.
\end{proof}
%

\bigskip

The overall ordering of tree dissimilarities in \refcor{cor:NNI_RF_bound}, \refprop{prop:CM_CC_bound} and \refprop{prop:Nav_CM_bound} can be combined as:
%
\begin{theorem} \label{thm:DissimilarityOrder}
For nondegenerate hierarchies,
\begin{align}
\frac{2}{3} \distRF \leq\frac{2}{3} \dist_{NNI} \leq \frac{2}{3}\distNav \leq \dist_{CM} \leq \distCC.
\end{align}
\end{theorem}


\bigskip



Finally, remark that the NNI navigation distance $\distNav$ can be generalized to a pair of trees, $\treeA$ and $\treeB$, in $\treetopspace_{\indexset}$ as 
%
\begin{align}\label{eq:NavDistanceAll}
\distNav\prl{\treeA, \treeB} = \frac{1}{2}\prl{\big.\norm{\mat{S}\prl{\treeA,\treeB}}_1 + \norm{\mat{S}\prl{\treeB,\treeA}}_1},
\end{align} 
%
which is nonnegative and symmetric.
Note that for nondegenerate trees $\treeA,\treeB \in \bintreetopspace_{\indexset}$, $\mat{S}\prl{\treeA,\treeB} =  \tr{\mat{S}\prl{\treeB,\treeA}}$,\footnote{$\tr{\mat{A}}$ denotes the transpose of a matrix $\mat{A}$.} so $\distNav$ in \refeqn{eq:NavDistanceAll} simplifies back to \refeqn{eq:NavPathLength3}.

\begin{proposition}\label{prop:Nav_CM_bound_Degenerate}
For any $\treeA, \treeB \in \treetopspace_{\indexset}$,
\begin{align}
\distNav\prl{\treeA,\treeB} \leq \prl{\frac{1}{8}\card{\indexset}^2 + \frac{1}{4}\card{\indexset}} \distCM\prl{\treeA,\treeB}.
\end{align}
\end{proposition} 
\begin{proof}
Note that the number of nontrivial children of a cluster of $\treeA$ and $\treeB$ can be at most $\frac{1}{2}\card{\indexset}$. 
Hence one can verify the result following  similar steps as in the  proof of \refprop{prop:Nav_CM_bound}. 
\end{proof}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Discussion and Numerical Analysis}
\label{sec:Discussion}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{Consensus Models and Median Trees}

Let us recall a definition : a \emph{median tree} of a set of sample trees is a tree whose sum of distances to the sample trees is minimum.
Although, the notion of a median tree is simple and well-defined, the problem of finding a median tree of a set of trees is generally a hard combinatorial problem. 
On the other hand, a consensus model of a set of sample trees is  a computationally efficient tool to  identify  common structures of sample trees.  
In particular, a  remark relating $\distCM$ and $\distNav$ to commonly used consensus models of a set of trees  and their median tree(s) is: 
 
\begin{proposition}
Both the strict and loose consensus trees, $T_{\ast}$ and $T^{\ast}$, of any set of trees $T$  in $\treetopspace_{\indexset}$ (\refdef{def.StrictLooseConsensus}) are median trees in the sense of the crossing,   $\distCM$\refeqn{eq.CMdistance}, and NNI navigation, $\distNav$ \refeqn{eq:NavPathLength}, dissimilarities i.e. they both minimize the sum of distances to the sample trees with the total distance of zero, for any $d \in \crl{\distCM, \distNav}$
%
\begin{align}
\sum_{\tree \in T} \dist\prl{\tree, T_{\ast}} = \sum_{\tree \in T} \dist\prl{\tree, T^{\ast}} = 0.
\end{align}
%
Moreover, the loose consensus tree is the maximal (finest) median tree sharing each of its clusters with at least one sample tree.  
\end{proposition} 
%
\begin{proof}
By \refdef{def.StrictLooseConsensus}, both strict and loose consensus trees only contain compatible clusters with the clusters of any tree in $T$, and 
the loose consensus tree is the finest median tree containing only clusters from the sample trees. 
Thus, the result  follows for both $\distCM$ and $\distNav$ due their relation in \refprop{prop:Nav_CM_bound_Degenerate}. 
\end{proof}
  


\begin{figure*}[htb]
\centering
\begin{tabular}{c}
\includegraphics[width= 0.85\textwidth]{pdfTreeDissimilarityUniformN25.eps} 
\\
\includegraphics[width= 0.85\textwidth]{cdfTreeDissimilarityUniformN25.eps}
\\
\small{(a)}
\\
\includegraphics[width= 0.85\textwidth]{pdfTreeDissimilarityYuleN25.eps} 
\\
\includegraphics[width= 0.85\textwidth]{cdfTreeDissimilarityYuleN25.eps} 
\\
\small{(b)}
\end{tabular}
\caption{Empirical distribution of tree dissimilarities in $\bintreetopspace_{\brl{25}}$: (from left to right) the Robinson-Foulds distance $\dist{RF}$ \refeqn{eq.RFdistance} , the matching split distance $\distMS$ (Def.\ref{def.MSdistance}), the cluster-cardinality distance $\distCC$ \refeqn{eq.CCdistance},  the crossing dissimilarity $\distCM$ \refeqn{eq.CMdistance}, and the NNI navigation dissimilarity $\distNav$ \refeqn{eq:NavPathLength}. 
100000 sample hierarchies  are generated using (a) the uniform  and (b)Yule model  \cite{semple_steel_2003}.
The resolutions of histograms, from left to right, are 1, 4, 64, 4, 1 unit(s), respectively.
 }
\label{fig:TreeMeasureDistributionN25}
\end{figure*}


\subsection{Sample Distribution of Dissimilarities}

As states in \cite{lin_rajan_moret_TCBB2012}, there is no available biologically motivated benchmark dataset for the comparison of different tree measures. 
As a result, a standard way of comparing tree dissimilarities is the statistical analysis of their distribution.
The shape of the distribution of a tree measure tells how informative it is; for example, a highly concentrated distribution means that the associated tree measure behaves like a discrete metric as in the case of the Robinson-Foulds distance  --- see \reffig{fig:TreeMeasureDistributionN25}. 
Finding a closed form expression for the distribution of a tree measure is a hard problem, and so extensive numerical simulations are generally applied to obtain its sample distribution.   
In particular, using the uniform and Yule model \cite{semple_steel_2003} for generating random trees, we compute the empirical distributions of $\distRF$, $\distMS$, $\distCC$, $\distCM$, and $\distNav$ as illustrated in \reffig{fig:TreeMeasureDistributionN25}.   
Moreover, in \reftab{tab:SkewnessKurtosis} we present two commonly used statistical  measures, skewness and kurtosis, for describing the shapes of the probability distribution of all these tree measures. 
Here, recall that the skewness of a probability distribution  measures its tendency on one side of the mean, and the concept of kurtosis measures the peakedness of the distribution.
In addition to their computational advantage over $\distMS$, as illustrated in both \reffig{fig:TreeMeasureDistributionN25} and \reftab{tab:SkewnessKurtosis}, like $\distMS$, our tree measures, $\distCC$, $\distCM$ and $\distNav$, are significantly more informative and discriminative, with wider ranges of values and symmetry, than $\distRF$. 
  





%
%Yule Model:
%Robinson-Fould Distance - Skewness = -2.7814, Kurtosis = 10.7113
%Matching Split Distance - Skewness = 0.0041, Kurtosis = 3.1352
%NNI Navigation Length - Skewness = -0.1027, Kurtosis = 3.0572
%Cluster-Cardinality Distance - Skewness = -1.2589, Kurtosis = 5.3814
%1-Norm Crossing Matrix - Skewness = -0.0170, Kurtosis = 3.1599
%Uniform Model:
%Robinson-Fould Distance - Skewness = -3.6416, Kurtosis = 16.5749
%Matching Split Distance - Skewness = 0.1220, Kurtosis = 2.9886
%NNI Navigation Length - Skewness = 0.8874, Kurtosis = 4.8491
%Cluster-Cardinality Distance - Skewness = -0.9292, Kurtosis = 3.8239
%1-Norm Crossing Matrix - Skewness = 0.1255, Kurtosis = 3.0950
\begin{table}
\caption{Skewness and Kurtosis Values for the Distributions of Tree Measures}
\label{tab:SkewnessKurtosis}
\centering
\begin{tabular}{|l|c|c|c|c|}
\hline
 & \multicolumn{2}{c|}{Skewness} & \multicolumn{2}{c|}{ Kurtosis} \\ \hline
 & Uniform & Yule &Uniform  & Yule\\ \hline
$\distRF$ \refeqn{eq.RFdistance}&  $-2.6162$ & $-2.0740$ & $9.8609$ & $7.3998$ \\ \hline
$\distMS$ (Def. \ref{def.MSdistance}) & $0.1293$ & $-0.0117$  & $3.0060$ & $3.1136$\\ \hline
$\distCC$ \refeqn{eq.CCdistance} & $-0.9294$ & $-1.2507$  & $3.8601$ & $5.2724$\\ \hline
$\distCM$ \refeqn{eq.CMdistance} & $0.1390$ & $-0.0405$  & $3.1275$ & $3.2103$ \\\hline 
$\distNav$ \refeqn{eq:NavPathLength} & $0.8809$ & $-0.1195$  & $4.8707$ & $3.0746$\\ \hline
\end{tabular}
\end{table}       


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conclusion}
\label{sec.Conclusion}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%This material below would go better in the conclusion snice it is giving opinions about future work.  In any case, I don't understand what you've said here, so you'll have to re work it with me.
% 
%Actually, an NNI navigation path is likely to have an eventual significance in such a setting since
%the measures of dissimilarity of $\distRF$, $\dist_{CM}$ and  $\distCC$
%respecting  a desired
%hierarchy $\tau^*$,   are all non-increasing (in fact, strictly decreasing,
%for a suitably weighted version of $\dist_{CM}$) along any of the equal length NNI navigation trajectories  that define $\dist_{Nav}$.

This paper presents three new tree measures  for efficient discriminative comparison of trees.
First, using the well-known relation between trees and ultrametrics, we construct the cluster-cardinality metric $\distCC$  as the pullback of matrix norms along an embedding of trees into the space of matrices .
Second, we present the crossing dissimilarity $\distCM$ that counts the pairwise incompatibilities of trees.
Third, we construct the NNI navigation dissimilarity $\distNav$ based on a kind of discrete path integral of (i.e. counting the steps along) the trajectory of an abstract discrete dynamical system in the space of trees.
All of our tree measures can be efficiently computed in time $\bigO{n^2}$ in the number of leaves, $n$.
Moreover, we provide  a closed form expression for each proposed tree measure and present an ordering relation between these tree dissimilarities and other related tree metrics.
In addition to being computationally more efficient than $\distMS$, using extensive numerical studies we demonstrate that the proposed tree measures are significantly more informative and discriminative than $\distRF$.   
 
  


\appendices





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Proofs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem.NNITriple}}
\label{app.NNITriple}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{proof}
The sufficiency is simply evident from  \refdef{def:NNIMove} since  the cluster sets of a pair of hierarchies  differ exactly by one  cluster if and only if they are joined by an NNI edge.

To see the necessity, let the NNI move on $\treeA$ at $P \in \grandchildset{\treeA}$ joins $\treeA$ to $\treeB$, and $R= \compLCL{P}{\treeA}$ and $Q= \grandparentCL{P,\treeA} \setminus \parentCL{P,\treeA}$. 
%That is to say, the NNI move on $\treetop'$ at $Q$ yields $\treetop$.
By \refdef{def:NNIMove}, $\crl{\parentCL{P,\treeA}} = \crl{P \cup R}=\cluster{\treeA}\setminus \cluster{\treeB}$ and  $\crl{\grandparentCL{P,\treeA} \setminus P} = \crl{R \cup Q}=\cluster{\treeB}\setminus \cluster{\treeA}$.
Further, $\prl{P,R,Q}$ is the only ordered triple of common clusters of $\treeA$ and $\treeB$ with the property that $\crl{P \cup R} = \cluster{\treeA} \setminus \cluster{\treeB}$ and $\crl{R\cup Q} = \cluster{\treeB}\setminus \cluster{\treeA}$ since the cluster sets of any NNI-adjacent hierarchies differs exactly by one element. 
\end{proof}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem:BinTreeRestriction}}
\label{app.BinTreeRestriction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{proof}
%Recall that 
%\begin{align}
%\treeres{K}\prl{\bintreetopspace_{\indexset}}= \bintreetopspace_{K} \Longleftrightarrow
%\begin{array}{c}
%\treeres{K}\prl{\bintreetopspace_{\indexset}} \supseteq \bintreetopspace_{K},\\ \treeres{K}\prl{\bintreetopspace_{\indexset}} \subseteq \bintreetopspace_{K}.
%\end{array} 
%\end{align}
%
To show that $\treeres{K}\prl{\bintreetopspace_{\indexset}} \supseteq \bintreetopspace_{K}$,  consider  nondegenerate trees $\treeA \in \bintreetopspace_{K}$ and $\treeC \in \bintreetopspace_{\indexset \setminus K}$, and let $\treeB \in \bintreetopspace_{\indexset}$ be the nondegenerate tree with cluster set
%
\begin{align}
\cluster{\treeB} = \cluster{\treeA} \cup \crl{\indexset} \cup \cluster{\treeC}.
\end{align}
%
Now, observe that $\treeA = \treeres{K}\prl{\treeB}$ by \refrem{rem:ClusterConcatenation} where $\childCL{\indexset, \treeB} = \crl{K,\indexset \setminus K}$.

To prove that $\treeres{K}\prl{\bintreetopspace_{\indexset}} \subseteq \bintreetopspace_{K}$, let $\treeB \in \bintreetopspace_{\indexset}$ and $I \in \cluster{\treeB}$ with the property that $\card{I \cap K} \geq 2$.
Note that $I \cap K$ is an interior cluster of $\treeressym{K}{\treeB}$.
We shall show that the cluster $I \cap K  \in \cluster{\treeressym{K}{\treeB}}$  always admits a bipartition in $\treeressym{K}{\treeB}$.
That is to say,  there exist a  cluster $A \in \cluster{\treeB}$ such that $A \cap K = I \cap K$ and $A_L \cap K \neq \emptyset$ and $A_R\cap K \neq \emptyset$ for $\crl{A_L,A_R} = \childCL{A,\treeB}$. 
Hence, $\childCL{I \cap K, \treeressym{K}{\treeB}} = \crl{A_L \cap K, A_R \cap K}$.  
 
Now observe that either $I_L \cap K \neq \emptyset$ and $I_R \cap K \neq \emptyset $ for $\crl{I_L,I_R} = \childCL{I,\treeB}$, or there exists one and only one descendant $D \in \descendantCL{I,\treeB}$ such that $I \cap K = D \cap K$ and $D_L \cap K \neq \emptyset$ and $D_R \cap K \neq \emptyset$ where $\crl{D_L, D_R} = \childCL{D,\treeB}$.

Thus, all the interior clusters of $\treeressym{K}{\treeB}$  have exactly two children, which completes the proof.
\end{proof}   

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem.treeUltrametric}}
\label{app.treeUltrametric}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{proof}
Let us start with the proof of the sufficiency. 
Positive definiteness and symmetry of $\dist_{\tree}$ are simply evident from  \refeqn{eq.treeUltrametric} and \reflem{lem.treeUltrametric}.\refeqn{it.heightIndiscernible}. 
To observe the strong triangle inequality, let $i\neq j \neq k \in \indexset$, and let $I \in \cluster{\tree}$ with the property that $i \in I_i$ and $j \in I_j$ where $\crl{I_i, I_j} \subseteq \childCL{I,\tree}$.%\footnote{Note that the number of children of a nonsigleton cluster of degenerate trees can be greater than two.}. 
Hence, one can easily observe that $I = \cancCL{\crl{i}}{\crl{j}}{\tree}$, and so $\dist_{\tree}\prl{i,j} = h_{\tree}\prl{I}$. 

If $k \in I$, without loss of generality, let $k \in I_i$, and so $k \not \in I_j$. 
Then, using \refeqn{eq.treeUltrametric} and \reflem{lem.treeUltrametric}.\refeqn{it.heightMonotonicity}, one can simply verify  that $\dist_{\tree}\prl{i,k} \leq h_{\tree}\prl{I_i} \leq h_{\tree}\prl{I}$ and $\dist_{\tree}\prl{j,k} = h_{\tree}\prl{I}$ since $\cancCL{\crl{i}}{\crl{k}}{\tree} \subseteq I_i$ and $\cancCL{\crl{j}}{\crl{k}}{\tree} = I$.
Note that if neither $k  \in I_i$ nor $k \in I_j$ (but still $k \in I$), $\dist_{\tree}\prl{i,k} = \dist_{\tree}\prl{j,k} = h_{\tree}\prl{I}$ since $\cancCL{\crl{i}}{\crl{k}}{\tree} = \cancCL{\crl{j}}{\crl{k}}{\tree}= I$.
  
Similarly, if $k \not \in I$, then we have $\dist_{\tree}\prl{i,k} \geq h_{\tree}\prl{I}$ and $\dist_{\tree}\prl{j, k} \geq h_{\tree}\prl{I}$ since only some ancestors of $I$ in $\tree$ might contain all $i,j,k$. 
Thus, we always have  $\dist_{\tree}\prl{i,j} \leq \max\prl{\big. \dist_{\tree}\prl{i,k}, \dist_{\tree}\prl{k, j}}$, which completes the proof  of the sufficiency. 

Let us continue with the necessity. Note that we have  \reflem{lem.treeUltrametric}.\refeqn{it.heightIndiscernible} from positive definiteness of $\dist_{\tree}$.  %and $h_{\tree}\prl{I} > 0$ for all $I \in \cluster{\tree}$ and $\card{I} > 1$. 
Let $I \in \cluster{\tree} \setminus \crl{\indexset}$ be any nonsingleton cluster of $\tree$ and $i \neq j \in I$ with the property that $\cancCL{\crl{i}}{\crl{j}}{\tree} = I$. %$\dist_{\tree}\prl{i,j} = h_{\tree}\prl{I}$. 
For any $k \in \compLCL{I}{\tree}$, we always have 
$\cancCL{\crl{i}}{\crl{k}}{\tree} = \cancCL{\crl{j}}{\crl{k}}{\tree} = \parentCL{I,\tree}$.
%$\dist_{\tree}\prl{i,k} = \dist_{\tree}\prl{j,k} = h_{\tree}\prl{P}$,
%where $P = \parentCL{I,\tree}$. 
Now, using the strong triangle inequality of $\dist_{\tree}$, one can easily see \reflem{lem.treeUltrametric}.\refeqn{it.heightMonotonicity} from
% 
{\small
\begin{align}
h_{\tree}\prl{I} \sqz{=} \dist_{\tree}\prl{i,j} \sqz{\leq} \max\prl{\big.\dist_{\tree}\prl{i,k}, \dist_{\tree}\prl{j,k}} \sqz{=} h_{\tree}\prl{\big. \parentCL{I,\tree}} \!,
\end{align}    
}
%
which completes the proof. 
\end{proof}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem.GraphMetricLowerBound}}
\label{app.GraphMetricLowerBound}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{proof}
The result simply follows from the triangle inequality of $\dist_X$. 

Let $x^0,x^* \in X$ and $\prl{x_k}_{0\leq k \leq K}$ be the sequence of points in $X$, where  $\prl{x_{k-1}, x_{k}} \in E$ for all $1 \leq k \leq K$ and $x_0 = x^0 $ and $x_K= x^*$, defining the shortest path between $x^0$ and $x^*$. To put it another way,
%
\begin{align}
\dist_{G}\prl{x^0,x^*} &= \sum_{k = 1}^{K} \underbrace{A(x_{k-1}, x_k)}_{\geq \dist_X\prl{x_{k-1}, x_k}}, \\
 &\geq \underbrace{\sum_{k = 1}^{K}\dist_{X}\prl{x_{k-1}, x_k}}_{\substack{\geq \dist_{X} \prl{x^0,x^*},\\ \text{from the triangle inequality}} } \geq \dist_{X} \prl{x^0,x^*},
\end{align}
%
which completes the proof.
\end{proof}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem:SplitCompatibleEquivalence}}
\label{app:SplitCompatibleEquivalence}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{proof}
By \refdef{def.ClusterCompatibility}, we have
% 
\begin{align}
\II \compatible \KK_L 
%
&\Longleftrightarrow 
%
\prl{\II  \subseteq \KK_L} 
\logicor 
\prl{\KK_L \not \subseteq \II} 
\logicor
\underbrace{\prl{\II \cap \KK_L = \emptyset}}_{\Leftrightarrow \II \subseteq \KK_R}, \\
%
&\Longleftrightarrow 
%
\prl{\II  \subseteq \KK_L} \logicor
\prl{\KK_L  \subseteq \II} \logicor
\prl{\II  \subseteq \KK_R}.
\end{align}  
%
Therefore, the incompatibility of cluster $\II$ with  $\crl{\KK_L,\KK_R} $ can be rewritten as
% 
\begin{align}
\II  \compatible \crl{\KK_L, \KK_R} & = \prl{\II \compatible \KK_L} 
\logicand 
\prl{\II  \compatible \KK_R},  \\
%
&\hspace{-18mm}= 
\prl{\II \subseteq \KK_L}
\sqz{\logicor}
\prl{\II \subseteq \KK_R} 
\sqz{\logicor} 
\underbrace{\prl{\!\Big. \prl{\KK_L  \subseteq \II} \logicand \prl{\KK_R  \subseteq \II}\!}}_{\text{false since } \II \subsetneq \KK = \KK_L \cup \KK_R}\!,\\
%
& \hspace{-18mm} = \prl{\II  \subseteq \KK_L}
\logicor
\prl{\II  \subseteq \KK_R}, 
\end{align}
%
and the lemma follows.  
\end{proof}

%\bigskip
%
%From \reflem{lem:SplitCompatibleEquivalence}, one can easily see the result in \reflem{lem:AncestorIncompatibility}:
%%
%\begin{proof}[Proof of \reflem{lem:AncestorIncompatibility}]
%%
%Let $\crl{K_L, K_R} =\childCL{\CommonXCL, \treeB}$ and $A \in \ancestorCL{\CLXSplit,\treeA} \cap \descendantCL{\CommonXCL,\treeA}$. 
%Notice that $\CLXSplit \subsetneq A \subsetneq \CommonXCL$. 
%Using \reflem{lem:SplitCompatibleEquivalence}, one can easily observe that
%\begin{align}
%\CLXSplit \not \compatible \crl{K_L, K_R} &\Longleftrightarrow 
%\begin{array}{c}
%\CLXSplit \not \subseteq K_L \prl{\Longrightarrow A \not \subseteq K_L} , \\
%\CLXSplit \not \subseteq K_R \prl{\Longrightarrow A \not \subseteq K_R},
%\end{array}\\
%&\Longrightarrow A \not \compatible \crl{K_L, K_R}.
%\end{align}
%%
%Thus, $A \in \CLXSplitSet{\treeA,\treeB; K}$, and the result follows.
%\end{proof}
% 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem:JointIncompatibility}}
\label{app:JointIncompatibility}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{proof}[Proof of \reflem{lem:JointIncompatibility}]
The sufficiency for being Type 2  directly follows from \refdef{def.ClusterCompatibility},
%
\begin{align}
 I \not \compatible D, \compLCL{I}{\treeA} \not \compatible D  &\Longrightarrow  I   \not \compatible \childCL{K,\treeB}, 
\compLCL{I}{\treeA} \not \compatible \childCL{K,\treeB}. 
\end{align}

To see the necessity for being Type 2, recall  from \reflem{lem:SplitCompatibleEquivalence} that 
%
\begin{align}
I \compatible \childCL{K,\treeB} &\Longleftrightarrow \prl{I \subseteq D} \logicor \prl{I \subseteq \prl{K \setminus D }},\nonumber \\
&\Longleftrightarrow \prl{I \subseteq D} \logicor \prl{I \cap D =\emptyset}, \label{eq.JointCrossing1} \\
\compLCL{I}{\treeA} \compatible \childCL{K,\treeB} & \Longleftrightarrow  \prl{\compLCL{I}{\treeA} \subseteq D} \logicor \prl{\compLCL{I}{\treeA} \cap D =\emptyset}. \nonumber
\end{align} 
%
Further, using \reflem{lem:SplitCompatibleEquivalence}, observe that 
%
\begin{align}
\begin{array}{l}
 D \subseteq I \Longrightarrow  \compLCL{I}{\treeA} \subseteq \prl{K \setminus D} \Longrightarrow \compLCL{I}{\treeA} \compatible \childCL{K,\treeB}, \\
 D \subseteq \compLCL{I}{\treeA} \Longrightarrow I \compatible \childCL{K,\treeB}.
\end{array}\label{eq.JointCrossing2}
\end{align}
%
As a result, using  \refeqn{eq.JointCrossing1} and \refeqn{eq.JointCrossing2}, one can obtain the necessity as
%
\begin{align}
 I \not \compatible \childCL{K,\treeB}, \compLCL{I}{\treeA} \not \compatible \childCL{K,\treeB} \Longrightarrow I \not\compatible D, \compLCL{I}{\treeA} \not\compatible D ,
\end{align}
%
which completes the proof.
\end{proof}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \refthm{thm.Stability}}
\label{app.Stability}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A useful observation characterizing the effect  of hierarchical attenuation constant $\hierconst$  below a certain level of a nondegenerate hierarchy is:  
%
%\vspace{-6mm}
\begin{lemma} \label{lem:HierConst}
For any cluster $K \in \cluster{\tree}$ of a  binary hierarchy $\tree \in \bintreetopspace_{\indexset}$,  the hierarchical attenuation constant $\hierconst$ satisfies  
%
\begin{align}
\sum_{I \in \descendantCL{K,\tree}} \frac{1}{\hierconst^{\depth{\tree}\prl{I}}} < \frac{2}{\hierconst - 2}\frac{1}{\hierconst^{\depth{\tree}\prl{K}}}, \;\;\; \forall  \hierconst > 2.
\end{align}

\end{lemma}
%
\begin{proof}
Proof by induction.  
\begin{itemize}
\item  \underline{For $\card{K} = 1$} (base case) : It is trivially true since $\descendantCL{K, \tree} =  \emptyset$. 

\item \underline{For $\card{K} \geq 2$} (induction): Using the clustering  identity between descendants  of cluster $K$  and its children, $\crl{K_L, K_R}=\childCL{K,\tree}$, in binary hierarchy $\tree$, 
%
%\begin{align} \label{eq:DescendantCLRelation}
%\descendantCL{K,\tree} = \childCL{K,\tree} \cup \descendantCL{K_L,\tree} \cup \descendantCL{K_R,\tree}, 
%\end{align}
%
we can factor the left hand side and find an upper bound as  
%\begin{align}
%\sum_{I \in \descendantCL{K,\tree}} \frac{1}{\hierconst^{\depth{\tree}{I}}} 
%= \sum_{I \in \childCL{K,\tree}} \frac{1}{\hierconst^{\depth{\tree}{I}}} 
%+ \sum_{I \in \descendantCL{K_L,\tree}} \frac{1}{\hierconst^{\depth{\tree}{I}}} 
%+ \sum_{I \in \descendantCL{K_R,\tree}} \frac{1}{\hierconst^{\depth{\tree}{I}}}.
%\end{align}
%
\begin{align}
\sum_{I \in \descendantCL{K,\tree}} \frac{1}{\hierconst^{\depth{\tree}\prl{I}}}& = \underbrace{\sum_{I \in \childCL{K,\tree}} \frac{1}{\hierconst^{\depth{\tree}\prl{I}}}}_{=\frac{2}{\hierconst^{\depth{\tree}\prl{K}+1}} }  
+ \underbrace{\sum_{I \in \descendantCL{K_L,\tree}} \frac{1}{\hierconst^{\depth{\tree}\prl{I}}}}_{< \frac{2}{\hierconst - 2}\frac{1}{\hierconst^{\depth{\tree}\prl{K_L}}}} \nonumber \\
& \hspace{10mm}+ \underbrace{\sum_{I \in \descendantCL{K_R,\tree}} \frac{1}{\hierconst^{\depth{\tree}\prl{I}}}}_{< \frac{2}{\hierconst - 2}\frac{1}{\hierconst^{\depth{\tree}\prl{K_R}}}},  \\
%%%
&< \frac{1}{\hierconst^{\depth{\tree}\prl{K}}} \prl{\frac{2}{ \hierconst} + \frac{4}{\hierconst \prl{\hierconst - 2}}}, \\
&=  \frac{2}{\hierconst - 2} \frac{1}{\hierconst^{\depth{\tree}\prl{K}}},
\end{align}
%
where the depth of children and parent clusters are related by $\depth{\tree}\prl{K_L} = \depth{\tree}\prl{K_R} = \depth{\tree}\prl{K} + 1$.
\end{itemize}
Thus, the result follows.
\end{proof}

Now, using  \reflem{lem:HierConst}, one can obtain an upper bound on the change of Lyapunov function after an NNI move as follows:
%
\begin{lemma} \label{lem.LyapunovChange}
For any desired hierarchy $\treeB \in \bintreetopspace_{\indexset}$ and hierarchical attenuation constant $\hierconst > 2$, the change in the value of Lyapunv function $V_{\treeB}$ \refeqn{eq:LyapunovCandidate} after the NNI move on  $\treeA\in \bintreetopspace_{\indexset}$  at $G \in \grandchildset{\treeA}$  is bounded from above as
%
{\small
\begin{align}
 V_{\treeB}\prl{\NNI\prl{\treeA,G} } \sqz{-} V_{\treeB}\prl{\treeA}  \hspace{0mm}< \frac{1}{\hierconst^{ \depth{\treeA}\prl{P}+ \depth{\treeB}\prl{K}+2}} \prl{ \frac{16\prl{\hierconst \sqz{-} 1}}{\prl{\hierconst \sqz{-} 2}^2} \sqz{-}1} \!,\!\!  \label{eq.LyapunovChangeUpBound}
\end{align}
}
%
where $P = \grandparentCL{G,\treeA}$ and $K \in \cluster{\treeB} $ satisfying $P \subseteq K$.\footnote{Such a cluster $K \in \cluster{\treetop^*}$ always exists since $P \subseteq \indexset$ and $\indexset \in \cluster{\treeB}$}.
\end{lemma}
\begin{proof}
See \refapp{app.LyapunovChange}.
\end{proof}

\bigskip

The result in \refthm{thm.Stability}  directly  follows from:
%
\begin{corollary} \label{cor.Stability}
For any desired hierarhy  $ \treeB \in \bintreetopspace_{\indexset}$  and  hierarchical attenuation constant  $\hierconst \geq 10 + 4 \sqrt{5} (\approx 18.94)$, the discrete dynamical system in \refeqn{eq:CLSystemModel} obeying the NNI control law  $\vectbf{u}_{\treeB}$ in \refsec{sec.NNIControl} strictly decreases the value of Lyapunov function $V_{\treeB}$ \refeqn{eq:LyapunovCandidate}  at any  hierarchy $\treeA  \in \bintreetopspace_{\indexset}$ away from   $\treeB$, 
%
\begin{align}
%\Delta V_{\treeB}\prl{\treeA} \footnotemark = 
\prl{V_{\treeB} \circ \NNI \circ \vectbf{u}_{\treeB}} \prl{\treeA } - V_{\treeB}\prl{\treeA } < 0.% \;\; \forall \treeA \neq \treeB \in \bintreetopspace_{\indexset}. 
\end{align}  

\end{corollary}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \reflem{lem.LyapunovChange} }
\label{app.LyapunovChange}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




Since the root cluster $\indexset$ is a common cluster of all hierarchies in $\bintreetopspace_{\indexset}$, we find it convenient to rewrite $V_{\treeB}$ \refeqn{eq:LyapunovCandidate} as 
%
\begin{align}
V_{\treeB}\prl{\treeA} %& = \sum_{J \in \cluster{\treeB}} \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}}\Phi_{\treeA}\prl{\big. \cluster{\treeA},  J}, \\
%
&=\sum_{J \in \cluster{\treeB}} \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}}\Phi_{\treeA}\prl{\big. \descendantCL{\indexset, \treeA},  J}, 
\end{align}
%
where  $\Phi_{\treeA}: \PowerSet{\big. \cluster{\treeA}} \times \cluster{\treeB} \rightarrow \R_{\geq 0}$  returns the total weighted incompatibilities of  a subset $\mathcal{A}$ of $\cluster{\treeA}$ with a cluster $B$ of $\treeB$,
%
\begin{align}
\Phi_{\treeA}\prl{\mathcal{A}, B} \ldf \sum_{A \in \mathcal{A}} \frac{1}{\hierconst^{\depth{\treeA}\prl{A}}}\indicatorfunc{A \not \compatible B}.
\end{align} 

Using the attenuation characteristic of $\hierconst$ over a nondegenerate hierarchy in \reflem{lem:HierConst}, lower and upper bounds of $\Phi_{\treeA} \prl{\big. \childCL{I,\treeA}, J}$ and  $\Phi_{\treeA}\prl{\big. \descendantCL{I,\treeA},J}$ for clusters $I \in \cluster{\treeA}$ and $J \in \cluster{\treeB}$ can be simply obtained as
%
\begin{align}
0 &\leq \Phi_{\treeA}\prl{\big. \childCL{I,\treeA}, J} \leq \frac{2}{\hierconst^{\depth{\treeA}\prl{I}+1}}, \label{eq:HierConstChildBound} \\
 0 &\leq \Phi_{\treeA}\prl{\big. \descendantCL{I,\treeA},J} < \frac{2}{\hierconst - 2} \frac{1}{\hierconst^{\depth{\treeA}\prl{I}}}, \label{eq:HierConstBound}
\end{align} 
%
for $\hierconst > 2$.

One  can  further factor out $\Phi_{\treeA}\prl{\big. \descendantCL{I,\treeA}, J}$ using the hierarchical relation between descendant clusters as 
%
{\small
\begin{align}
\Phi_{\treeA}\prl{\big. \descendantCL{I,\treeA},J} &= \Phi_{\treeA}\prl{\big. \childCL{I,\treeA},J} 
 +  \Phi_{\treeA}\prl{\big. \descendantCL{I_L,\treeA},J} \nonumber\\
 &\hspace{10mm}+ \Phi_{\treeA}\prl{\big. \descendantCL{I_R,\treeA},J},  \label{eq:DescentFactor}
\end{align}
}
%
where $\crl{I_L, I_R} = \childCL{I,\treeA}$. Combining 
all \refeqn{eq:HierConstChildBound}, \refeqn{eq:HierConstBound} and \refeqn{eq:DescentFactor} yields the following tighter lower and upper bounds on $\Phi_{\treeA}\prl{\descendantCL{I}, J}$,
%
{\small
\begin{align}
\hspace{-1.5mm} \Phi_{\treeA}\prl{\big. \childCL{I,\treeA}, J} &\sqz{\leq} \Phi_{\treeA}\prl{\big. \descendantCL{I,\treeA},J} \nonumber \\
 & \hspace{4.5mm}<  \Phi_{\treeA}\prl{\big. \childCL{I,\treeA}, J} \sqz{+} \frac{4}{\hierconst -2} \frac{1}{\hierconst^{\depth{\treeA}\prl{I}+1}}. \label{eq:TightHierConstBound}
\end{align} 
}
%
Here, note that the levels of children and parent clusters are related to each other by   $\depth{\treeA}\prl{I_L} = \depth{\treeA}\prl{I_R} = \depth{\treeA}\prl{I} + 1$.

\bigskip

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\noindent \textbf{Change in the value of Lyapunov function:} \mbox{}\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Before continue with the proof of \reflem{lem.LyapunovChange}, a useful observation about the local restructuring of trees after an NNI move is: 

\begin{remark} \label{rem:NNIPreservedHierarchy}
Let $\prl{\treeA, \treeC}$ be any edge in the NNI-graph $\NNIgraph_{\indexset} = \prl{\bintreetopspace_{\indexset}, \NNIedgeset}$. 
Then, the NNI move on $\treeA$ at  $G \in \grandchildset{\treeA}$ joining $\treeC$  changes the hierarchical organization of common clusters descending the (grand) parent cluster $P = \grandparentCL{G,\treeA} = \parentCL{G,\treeC}$ of (grand) child $G$ and keeps the remaining clusters  unchanged with the property that
for all $I \in \cluster{\treeA} \setminus \descendantCL{P,\treeA} = \cluster{\treeC} \setminus \descendantCL{P,\treeC}$
%
\begin{align}
\depth{\treeA}\prl{I} = \depth{\treeC}\prl{I}.
\end{align}   
\end{remark}

We now continue with  the change in the value of Lyapunov function  after the NNI move on $\treeA$  at $G$ towards $\treeC = NNI \prl{\treeA, G}$,
{\small
\begin{align}
  V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA} \sqz{=} \hspace{-1mm}  \sum_{J \in \cluster{\treeB}} \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}} \! 
&\left(\sqz{\Big.  \Phi_{\treeC}\prl{\big. \descendantCL{J,\treeC} \! , J} \right. \nonumber\\
& \hspace{5mm}\left. \Big. - \Phi_{\treeA}\prl{\big. \descendantCL{J,\treeA} \! ,J}} \right)\!. \!\!\! \label{eq:LyapunovChange1}
\end{align} 
}
%
%Recall from \refrem{rem:NNIPreservedHierarchy} that the NNI move joining $\treeA$ to $\treeC$ only change cluster relations below the (grand)parent cluster $P=\grandparentCL{G,\treeA} = \parentCL{G,\treeC}$, and the hierarchical organization of clusters $\cluster{\treeA} \setminus  \descendantCL{P, \treeA} = \cluster{\treeC} \setminus  \descendantCL{P, \treeC}$ stays unchanged. Thus, 
Using \refrem{rem:NNIPreservedHierarchy}, one can  rewrite  \refeqn{eq:LyapunovChange1}  in terms of (grand)parent cluster $P = \grandparentCL{G,\treeA} = \parentCL{G,\treeC}$ as
%
{\small
\begin{align}
V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA}
\sqz{=}  \sum_{J \in \cluster{\treeB}} \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}} &\left ( \Big. \Phi_{\treeC}\prl{\big.\descendantCL{P,\treeC},J} \right . \nonumber \\
& \hspace{5mm}\left. \Big. - \Phi_{\treeA}\prl{\big. \descendantCL{P,\treeA},J} \right ). \label{eq:LyapunovChange2}
\end{align}
}
%
Let $Q \in \cluster{\treeB}$ with the property that  $P \subseteq Q$. 
Notice that every cluster $J$ in $\cluster{\treeB} \setminus \descendantCL{Q,\treeB}$ either contains or  is disjoint  with  clusters $I \in \descendantCL{P,\treeA}$ and $K \in \descendantCL{P,\treeC}$, and so they are compatible, i.e. $ I \compatible J \text{ and } K \compatible J$. 
As a result, \refeqn{eq:LyapunovChange2} can be further simplified as 
%
{\small
\begin{align}
V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA}
\sqz{=} \hspace{-2mm} \sum_{J \in \descendantCL{Q, \treeB}}  \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}} & \left (\Big. \Phi_{\treeC}\prl{\big. \descendantCL{P,\treeC},J} \right. \nonumber \\
& \hspace{3mm}\left. \Big. - \Phi_{\treeA}\prl{\big. \descendantCL{P,\treeA},J} \! \right) \!. \label{eq:LyapunovChange3}
\end{align}
} 
%
Now, using the bounds on $\Phi_{\treeA}\prl{\big. \descendantCL{P,\treeA}, J}$ in \refeqn{eq:TightHierConstBound} and  the property of hierarchical attenuation constant in \reflem{lem:HierConst},  an upper bound on \refeqn{eq:LyapunovChange3} can be obtained as
%
{\small
\begin{align}
V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA} &\sqz{<} \hspace{-2mm} \sum_{J \in \descendantCL{Q, \treeB}} \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}} \left( \Big.  \frac{4}{\hierconst - 2}\frac{1}{\hierconst^{\depth{\treeA}\prl{P}+1}}  \right . \nonumber\\
& \hspace{5mm}\left . \bigg. + \Phi_{\treeC}\prl{\big. \childCL{P,\treeC}\!,J} \sqz{-} \Phi_{\treeA}\prl{\big. \childCL{P,\treeA}\!,J}\!\!\right)\!, \!\!\\
& \hspace{-18mm} < \frac{8}{\prl{\hierconst - 2}^2}\frac{1}{\hierconst^{\depth{\treeA}\prl{P}+\depth{\treeB}\prl{Q}+1}} +  \nonumber \\
&\hspace{-13mm} + \hspace{-3mm}\sum_{J \in \descendantCL{Q, \treeB\!}} \!\! \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}} \! \prl{\!\Big.\Phi_{\treeC}\prl{\big. \childCL{P,\treeC}\!,J} \sqz{-} \Phi_{\treeA}\prl{\big. \childCL{P,\treeA}\!,J}\!\!} \!, \!\!
\end{align}
}
where $\depth{\treeA}\prl{P} = \depth{\treeC}\prl{P}$.
Further, using the hierarchical relation between descendant clusters, we might obtain a looser upper bound in terms of clusters $P$ and $Q $ and their children as follows:
%
{\small
\begin{align}
V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA} &<\frac{8}{\prl{\hierconst - 2}^2} \frac{1}{\hierconst^{\depth{\treeA}\prl{P}+\depth{\treeB}\prl{Q}+1}}   \nonumber \\
%
& \hspace{-15mm} +\frac{1}{\hierconst^{\depth{\treeB}\prl{Q} +1}} \!\!  \sum_{J \in \childCL{Q, \treeB}} \!\!\!\prl{\Big.  \Phi_{\treeC}\prl{\big. \childCL{P,\treeC},J} \sqz{-} \Phi_{\treeA}\prl{\big. \childCL{P,\treeA},J}\!\!}  \nonumber \\
%
& \hspace{-13mm} +  \hspace{-6mm}\underbrace{\sum_{J \in \descendantCL{Q_L, \treeB}} \!\!\frac{1}{\hierconst^{\depth{\treeB}\prl{J}}}}_{< \frac{2}{\hierconst - 2}\frac{1}{\hierconst^{\depth{\treeB}\prl{Q} + 1}} \text{, by \reflem{lem:HierConst}}} \!\!\! \underbrace{\prl{\Big. \! \Phi_{\treeC}\prl{\big. \childCL{P,\treeC},J} \sqz{-} \Phi_{\treeA}\prl{\big. \childCL{P,\treeA},J}\!\!}}_{\leq \frac{2}{\hierconst^{\depth{\treeA}\prl{P}+1}}, \text{ from \refeqn{eq:HierConstChildBound} and } \depth{\treeA}\prl{P} = \depth{\treeC}\prl{P}   }  \nonumber \\
%
& \hspace{-11mm} + \hspace{-6mm}\underbrace{ \sum_{J \in \descendantCL{Q_R, \treeB}} \!\! \frac{1}{\hierconst^{\depth{\treeB}\prl{J}}}}_{< \frac{2}{\hierconst - 2}\frac{1}{\hierconst^{\depth{\treeB}\prl{Q} + 1}} \text{, by \reflem{lem:HierConst}}} \!\!\!  \underbrace{\prl{\Big. \! \Phi_{\treeC}\prl{\big. \childCL{P,\treeC},J} \sqz{-} \Phi_{\treeA}\prl{\big. \childCL{P,\treeA},J}\!\!}}_{\leq \frac{2}{\hierconst^{\depth{\treeA}\prl{P}+1}}, \text{ from \refeqn{eq:HierConstChildBound} and } \depth{\treeA}\prl{P} = \depth{\treeC}\prl{P}   } ,  
\end{align}
\vspace{-4mm}
\begin{align}
\hspace{-1mm}V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA} & \sqz{<} \frac{1}{\hierconst^{\depth{\treeB}\prl{Q}+ \depth{\treeA}\prl{P}+2}} \left ( \Bigg. \frac{16 \prl{\hierconst - 1}}{\prl{\hierconst- 2}^2} \right. \nonumber \\
& \hspace{6mm} +   \hspace{-3mm}\sum_{\substack{K \in \childCL{P,\treeC}\\J \in \childCL{Q, \treeB}}} \hspace{-2mm} \indicatorfunc{K \not \compatible J} - \hspace{-2mm}\sum_{\substack{I \in \childCL{P,\treeA}\\J \in \childCL{Q, \treeB}} } \hspace{-2mm}\indicatorfunc{I \not \compatible J} \left. \Bigg. \!\!\! \right  )\!. \!\!
\label{eq:LyapunovChangeUpBound1}
\end{align}
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\noindent \textbf{Relation Between the Lyapunov Function and NNI Control Law:} \mbox{}\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



For any $\treeA \neq \treeB \in \bintreetopspace_{\indexset}$,  let $\CommonXCL \in \CommonXSplits{\treeA,\treeB}$ and $I\in \DeepXSplit{\treeA,\treeB; \CommonXCL}$ be 
the clusters selected by the NNI control policy $\vectbf{u}_{\treeB}$ of \refsec{sec.NNIControl}
while determining the NNI move on $\treeA$ at $G \in \childCL{I,\treeA}$ towards   $\treeC = \prl{\NNI \circ \vectbf{u}_{\treeB}}\prl{\treeA}$. Here, note that $P= \parentCL{I,\treeA}= \parentCL{G,\treeC} \subseteq K$.

Let $\Xsum{\treeA,\treeB}\prl{P, K}$ denote the total number of crossings between children of $P$ in $\treeA$ and children of $K$ in $\treeB$,
%
\begin{align} \label{eq.Xsum}
\Xsum{\treeA,\treeB}{P,K} \ldf \sum_{\substack{I \in \childCL{P,\treeA}\\ J \in \childCL{K,\treeB}}} \indicatorfunc{I \not \compatible J }.
\end{align}
%
Accordingly, the upper bound in the change of Lyapunov function  \refeqn{eq:LyapunovChangeUpBound1} after the aforementioned NNI move can be rewritten  as a function of $\Xsum{\treeA,\treeB}\prl{P,\CommonXCL}$ and $\Xsum{\treeC,\treeB}\prl{P,\CommonXCL}$  \refeqn{eq.Xsum}:
%
\begin{align}
V_{\treeB}\prl{\treeC} \sqz{-}  V_{\treeB}\prl{\treeA} < \frac{1}{\hierconst^{\depth{\treeB}\prl{K}+ \depth{\treeA}\prl{P}+2}}
& \left (\Big. \frac{16\prl{\hierconst - 1}}{\prl{\hierconst - 2}^2} \right . \nonumber \\
& \hspace{-13mm}\left. \Bigg. \sqz{+} \Xsum{\treeC, \treeB} \prl{P,K}  \sqz{-}\Xsum{\treeA, \treeB} \prl{P,K}\!\right)\!. \!\! 
\label{eq:LyapunovChangeUpBound2}
\end{align}
To complete the proof of \reflem{lem.LyapunovChange}, we shall show that
\begin{align}
\Xsum{\treeC, \treeB} \prl{P,K}  \sqz{-}\Xsum{\treeA, \treeB} \prl{P,K} \leq -1.
\end{align}



Depending on the incompatibility of $I$ with $\childCL{\CommonXCL, \treeB}$,   the values of $\Xsum{\treeA,\treeB}\prl{P,\CommonXCL}$ and $\Xsum{\treeC,\treeB}\prl{P,\CommonXCL}$ can be bounded from above as follows:
%
\begin{itemize}
\item \underline{Case 1 : $I$ is Type 1 :} \\
If  $I \in \DeepXSplit{\treeA,\treeB; \CommonXCL}$ is Type 1, then, by \refdef{def:SingleJointIncompatibility}, $I \not  \compatible \childCL{\CommonXCL,\treeB}$ and $\compLCL{I}{\treeA} \compatible \childCL{\CommonXCL,\treeB}$. 
Recall that $\crl{I, \compLCL{I}{\treeA}} = \childCL{P,\treeA}$. 
Hence, one can obtain that 
%
{\small
\begin{align}
\Xsum{\treeA,\treeB}\prl{P,K} &= \sum_{F \in \childCL{K, \treeB}} 
\hspace{-2.5mm}\underbrace{\sum_{E \in \childCL{P,\treeA}}    \indicatorfunc{E \not \compatible F}}_{= \indicatorfunc{I \not \compatible F}, \text{ since } \compLCL{I}{\treeA} \compatible \childCL{\CommonXCL,\treeB}},  \\
& =\underbrace{\sum_{F \in \childCL{K, \treeB}} \indicatorfunc{I \not \compatible F}}_{\geq 1, \text{ since } I \not \compatible \childCL{K,\treeB}} \geq 1.
\end{align}
}

Further, the NNI control rule $\vectbf{u}_{\treeB}$  replaces $I$ by  $J = \grandparentCL{G,\treeA}\setminus G$ whose local complement $\compLCL{J}{\treeC}$ in $\treeC$ is  $G$.
Note that $J$ and $\compLCL{J}{\treeC}$ are both   compatible with  $\childCL{\CommonXCL,\treeB}$. %(since  $G \in \childCL{I,\treeA}$ and, by \refdef{def:SingleJointIncompatibility}, $\childCL{I,\treeA} \compatible \childCL{K,\treeB}$). 
Note that $\crl{J, \compLCL{J}{\treeC}} = \childCL{P,\treeC}$.
Therefore, 
%
{\small
\begin{align}
\Xsum{\treeC, \treeB}\prl{P,K} =  \sum_{\substack{D \in \childCL{P, \treeC}\\ F \in \childCL{K,\treeB}}}   \underbrace{\indicatorfunc{D \not \compatible F}}_{= 0, \text{since } D \compatible \childCL{K,\treeB}} = 0 . \!\! 
\end{align}
}

As a result, for a Type 1 cluster, we always have
%
\begin{align}
\Xsum{\treeC,\treeB}\prl{P,K} - \Xsum{\treeA,\treeB}\prl{P,K} \leq -1.
\end{align}


\item \underline{Case 2 - $I$ is Type 2 :}\\
In this case, by \refdef{def:SingleJointIncompatibility},  siblings  $I, \compLCL{I}{\treeA} \in \DeepXSplit{\treeA,\treeB; K}$  are both incompatible with $\childCL{K,\treeB}$. 
In fact, by \reflem{lem:JointIncompatibility}, for all $E \in \crl{I, \compLCL{I}{\treeA}}=\childCL{P,\treeA}$ and $F \in \childCL{K,\treeB}$ we have $E \not \compatible F $.
Thus,
%
\begin{align}
\Xsum{\treeA,\treeB}\prl{P,K} =\sum_{\substack{E \in \childCL{P,\treeA} \\ F \in \childCL{K, \treeB}}}   \underbrace{ \indicatorfunc{E \not \compatible F}}_{= 1, \text{by \reflem{lem:JointIncompatibility}} } = 4. 
\end{align}

On the other hand, any arbitrary NNI move $G \in \childCL{I,\treeA}$ replaces cluster $I$ by  $J = \grandparentCL{G,\treeA} \setminus G$ incompatible with $\childCL{K,\treeB}$. Note that its sibbling $\compLCL{J}{\treeC}$ in $\treeC$ is $G$ and  compatible with split $\childCL{K,\treeB}$. 
Hence,  we have $J \not \compatible \childCL{\CommonXCL, \treeB}$ and $\compLCL{J}{\treeC} \compatible \childCL{\CommonXCL, \treeB}$ for children clusters $\crl{J, \compLCL{J}{\treeC}} = \childCL{P,\treeC}$, which yields
%
{\small
\begin{align}
\hspace{-2mm}\Xsum{\treeC,\treeB}\prl{P,K} &= \sum_{F \in \childCL{K, \treeB}} \hspace{-2mm}\underbrace{ \sum_{D \in \childCL{P, \treeC}}   \indicatorfunc{D \not \compatible F}}_{= \indicatorfunc{J \not \compatible F}, \text{ since }   \compLCL{J}{\treeC} \compatible \childCL{K,\treeB}}, \\
&=\sum_{F \in \childCL{K, \treeB}} \indicatorfunc{J \not \compatible F} \leq 2.
\end{align} 
}
%
Therefore, for a Type 2 cluster, we always have
%
\begin{align}
\Xsum{\treeC,\treeB}\prl{P,K} - \Xsum{\treeA, \treeB}\prl{P,K} \leq -2.
\end{align}
%{\small
%\begin{align}
%\Upsilon_{\treeA,\treeC}^{\treeB} \prl{P, K} &= \sum_{E^* \in \childCL{K, \treeB}} \prl{ \underbrace{ \sum_{E' \in \childCL{P, \treeC}}   \indicatorfunc{E' \not \compatible E^*}}_{= \indicatorfunc{I' \not \compatible E^*}, \text{ since }   \complementLCL{I'} \compatible \childCL{K,\treeB}} - \sum_{E \in \childCL{P,\treeA}}   \underbrace{ \indicatorfunc{E \not \compatible E^*}}_{= 1, \text{by \reflem{lem:TripleStepSplitCompatibility} and } E \equiv T} } \\
%&=   -4 + \sum_{E^* \in \childCL{K, \treeB}} \underbrace{\indicatorfunc{I' \not \compatible E^*}}_{\leq 1} \leq -2.
%\end{align}
%}
\end{itemize}
%

To sum up, the NNI control policy $\vectbf{u}_{\treeB}$ always guarantees that $\Xsum{\treeC,\treeB} \prl{P, K} -\Xsum{\treeA,\treeB} \prl{P, K} \leq -1$  after each evolution of the dynamical system \refeqn{eq:SystemModel} at every $\treeA$ away from $\treeB$. This completes the proof. \hfill $\square$

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proof of \refthm{thm:NavPathLength}}
\label{app:NavPathLength}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%We find it convenient to introduce some more notation before continue with  NNI navigation paths of the NNI graph.  
  
\begin{lemma} \label{lem:EquivalentSplitCompatibility}
Let $\crl{\KK_L, \KK_R}$ be a bipartition of a fixed finite set $\KK$, and $\II$ and $\AA$ be sets with the property that $\II \subseteq \AA, \II \subsetneq \KK$. Then the following equivalence holds
%  
\begin{align}
    \II  \compatible \crl{\KK_L, \KK_R} = \II  \compatible \treeressym{\AA}{\crl{\KK_L, \KK_R}}, 
\end{align} 
%
where  $\treeressym{\AA}{\crl{\KK_L, \KK_R}}$   is the restriction  of $\crl{\KK_L, \KK_R}$ to $\AA$ (\refdef{def:TreeRestriction}).
\end{lemma}
%
\begin{proof}
Note that for any sets $\XX \subseteq \ZZ$ and $\YY$ we always have $\XX \subseteq \YY \Leftrightarrow \XX \subseteq \YY \cap \ZZ$. 
Accordingly, one can obtain the result using \reflem{lem:SplitCompatibleEquivalence} as follows,
%
\begin{align}
\II  \compatible \crl{\KK_L, \KK_R}  &\Longleftrightarrow 
\underbrace{\prl{\II  \subseteq \KK_L}}_{ \Leftrightarrow \II  \subseteq \KK_L \cap \AA} \logicor 
\underbrace{\prl{\II \subseteq \KK_R}}_{ \Leftrightarrow \II  \subseteq \KK_R \cap \AA},
\\
& \Longleftrightarrow \II  \compatible \crl{\KK_L \cap \AA, \KK_R \cap \AA}.
\\
& \Longleftrightarrow \II  \compatible \underbrace{\prl{\big. \crl{\KK_L \cap \AA, \KK_R \cap \AA}\setminus \crl{\emptyset}}}_{=  \treeressym{\AA}{\crl{\KK_L, \KK_R}}}, \\
& \Longleftrightarrow \II  \compatible \treeressym{\AA}{\crl{\KK_L, \KK_R}}.
\end{align}
%
\end{proof}

\begin{lemma} \label{lem:CommonChildIncompatibility}
Let $\crl{K_L,K_R}$ and $\crl{K_L^*, K_R^*}$ be two bipartitions a fixed finite set $K$. 
The sum of compatible elements of one bipartition with the other bipartition is symmetric,
%
{\small
\begin{align}  \label{eq:SumBipartition}
\sum_{I \in \crl{K_L,K_R}} \hspace{-5mm}\indicatorfunc{\big. I  \compatible \crl{K_L^*,K_R^*}} = \hspace{-2mm} \sum_{I^* \in \crl{K_L^*,K_R^*}} \hspace{-5mm} \indicatorfunc{ \big. I^*  \compatible \crl{K_L,K_R}}\!, \!\!
\end{align}
}  
%
and is  only zero when bipartitions are the same.
\end{lemma}
%
\begin{proof}
If the bipartitions are the same, both sides of \refeqn{eq:SumBipartition} simply sum to two.

Otherwise, since $\crl{\CommonXCL_L, \CommonXCL_R}$ and $ \crl{\CommonXCL_L^*, \CommonXCL_R^*}$  are distinct binary partitions of $\CommonXCL$, at most an element of $\crl{\CommonXCL_L, \CommonXCL_R}$ is  a proper subset of an element of $\crl{\CommonXCL_L^*, \CommonXCL_R^*}$ and vice versa. 
One way to observe this is a proof by contradiction. 
Let each element of $\crl{\CommonXCL_L, \CommonXCL_R}$ is a proper subset of an element of $\crl{\CommonXCL_L^*, \CommonXCL_R^*}$, then $\CommonXCL_L \subsetneq \CommonXCL_L^* \cup \CommonXCL_R^*$ and $\CommonXCL_R \subsetneq \CommonXCL_L^* \cup \CommonXCL_R^*$. Hence, we have $\CommonXCL_L \cup \CommonXCL_R  \subsetneq \CommonXCL_L^* \cup \CommonXCL_R^* = \CommonXCL$, which is a contradiction.  

Now, if, without loss of generality, $\CommonXCL_L \subsetneq \CommonXCL_L^*$, that is to say $K_R^* \subsetneq K_R$, $\CommonXCL_R \not \subseteq \CommonXCL_L^*$ and $\CommonXCL_L^* \not \subseteq \CommonXCL_R$, then using \reflem{lem:SplitCompatibleEquivalence} one can easily verify that both sides of \refeqn{eq:SumBipartition} sum to one. 
Otherwise (none of elements of a bipartition are a proper subset any element of other bipartition), the summations on both side of \refeqn{eq:SumBipartition} are equal to zero since  every pair of elements of the bipartitions are not subset of each other and so are incompatible. 
This completes the proof. 
\end{proof}


\begin{lemma} \label{lem:SplitCompatibilitySum}
For any $\treeA,\treeB \in \bintreetopspace_{\indexset}$, the number of special crossings  $\sumST_{\treeA,\treeB}\prl{I,J}$ \refeqn{eq.sumST2} of children of $I\in \cluster{\treeA}$ in $\treeA$ with children of $J \in \cluster{\treeB}$ in  $\treeB$ is symmetric,
%
\begin{align}\label{eq:SplitCompatibilitySum}
\sumST_{\treeA,\treeB}\prl{I,J} = \sumST_{\treeB,\treeA}\prl{J,I},
\end{align}  
\end{lemma}
%
\begin{proof}
Consider a special case where at least one of $\treeressym{J}{\childCL{I,\treeA}}= \crl{I \cap J, \emptyset}$ and $\treeressym{I}{\childCL{J,\treeB}} = \crl{J \cap I, \emptyset}$ holds. 
Then, it is clear that $\sumST_{\treeA,\treeB}\prl{ I, J} = \sumST_{\treeB,\treeA}\prl{J,I} = 0$ since the empty cluster and   $I \cap J$  are always compatible with any cluster $A \subseteq I \cap J$. 

Otherwise, observe that $\treeressym{J}{\childCL{I,\treeA}} = \childCL{I \cap J, \treeressym{I \cap J}{\treeA}}$ and $\treeressym{I}{\childCL{J,\treeB}} = \childCL{I \cap J, \treeressym{I \cap J}{\treeB}}$, and so \refeqn{eq:SplitCompatibilitySum} takes the specific form in  \reflem{lem:CommonChildIncompatibility},
which completes the proof.
\end{proof}



\bigskip


\begin{proof}[Proof of \refthm{thm:NavPathLength}] 
%
Consider an NNI navigation path  starting at $\treeA$ and ending at $\treeB$. 
Let $\mathcal{G} = \prl{G^1, G^2, \ldots, G^{\card{\NavPathSym} - 1}}$ and $\mathcal{K} = \prl{K^1, K^2, \ldots, K^{\card{\NavPathSym} - 1}}$ be the ordered set of grandchild and common clusters with crossing splits selected by the NNI control law while constructing $\NavPathSym$.

Now observe that one can reorder $\mathcal{G}$ and $\mathcal{K}$ such that:
\begin{itemize}
\item the order relation of any pair of grandchildren in $\mathcal{G}$ associated with the same common cluster $K \in \mathcal{K}$ is preserved, which is required to define another valid NNI navigation path.
\item any grandchild  associated with $\indexset$, if $ \indexset \in \mathcal{K}$, is less than any grandchild associated with a common cluster in $\mathcal{K} \setminus \crl{\indexset}$.  
\end{itemize}
%
For instance, consider the following ordering of elements of $\mathcal{G}$: for any $i,j \in \brl{1, \card{\NavPathSym} - 1} $ 
% 
\begin{align}\label{eq.reordering}
G^i \leq G^j \Longleftrightarrow  \begin{array}{c}
\prl{K^i = \indexset, K^j \neq \indexset} \text{or } \\
\prl{i \leq j, K^i = \indexset,  K^j = \indexset} \text{or } \\
\prl{i \leq j, K^i \neq \indexset,  K^j \neq \indexset}.
\end{array} 
\end{align}
%
Let $\tilde{\mathcal{G}} = \prl{\tilde{G}^1, \tilde{G}^2, \ldots, \tilde{G}^{\card{\NavPathSym} -1}}$ denotes the reordering of $\mathcal{G}$ based on the ordering relation in  \refeqn{eq.reordering}, and $\tilde{\mathcal{K}} = \prl{\tilde{K}^1, \tilde{K}^2, \ldots, \tilde{K}^{\card{\NavPathSym} -1}}$ is the associated set of common clusters in $\mathcal{K}$ in the appropriate order, i.e. for any $i,j \in \brl{1, \card{\NavPathSym} -1}$, $K^i \leq K^j \Longleftrightarrow \tilde{G}^i \leq \tilde{G}^j$.
Notice that, by decomposability property of the NNI control law, the NNI moves associated with $\tilde{\mathcal{G}}$ defines an NNI navigation path $\tilde{\NavPathSym} \in \NavPathSet{\treeB}{\treeA}$ joining $\treeA$ to $\treeB$. 
Remark that $\NavPathSym$ and $\tilde{\NavPathSym}$ might be different, but they have the same length.

Hence, all NNI navigation paths from $\treeA$ to $\treeB$ can be rearrange in an appropriate way so that they first solve the incompatibilities of $\treeA$ with the root split $\childCL{\indexset,\treeB}$ of $\treeB$
and continue with joining subtrees of the root. 
In other words, using the decomposability property of the NNI control law, the length of any NNI navigation path $\NavPathSym$ joining $\treeA$ to $\treeB$ can be recursively obtained as
%
\begin{align}\label{eq:NavPathLengthP1}
\card{\NavPathSym} - 1 = \distNav\prl{\treeA, \bintreetopspace_{\childCL{\indexset,\treeB}}} 
&+ \distNav\prl{\treeressym{\indexset_L}{\treeA}, \treeressym{\indexset_L}{\treeB}} \nonumber \\
& \hspace{-5mm}+\distNav\prl{\treeressym{\indexset_R}{\treeA}, \treeressym{\indexset_R}{\treeB}},
\end{align}
%
where $\crl{\indexset_L, \indexset_R} = \childCL{\indexset, \treeB}$.


Moreover, using \reflem{lem:IntermediateHierarchy}, we can rewrite \refeqn{eq:NavPathLengthP1} as follows,
%
\begin{align} \label{eq:NavPathLengthP2}
\card{\NavPathSym} - 1 &= \hspace{-1mm}\sum_{\substack{J \in \cluster{\treeB} \\ I \in \cluster{ \treeressym{J}{\treeA}}}}  
\hspace{-2mm} \prl{\walkST \circ \sumST_{\treeressym{J}{\treeA},\childCL{J,\treeB}}}\prl{I},
%\Bigg({\sum_{A \in \childCL{I,\treeprojfunc{J}{\treeA}}} \hspace{-2mm}\indicator{  \underbrace{\big(A \not \compatible \childCL{J,\treeB} \! \big)}_{\substack{
 %= A \not \compatible \childCL{J,\treeB} \sqcap I \\ \text{ by \reflem{lem:EquivalentSplitCrossing} }}}}} \Bigg),
\end{align}
%
where $\sumST_{\treeA,\childCL{J,\treeB}}\prl{I}$ \refeqn{eq:sumST1} determines the number of children of $I \in \cluster{\treeA}$ in $\treeA$ incompatible with $\childCL{J, \treeB}$ and $\walkST$ \refeqn{eq.walkST} returns the required number of NNI moves to resolve these cluster incompatibilities. 


\bigskip


Let  $J \in \cluster{\treeB}$ with $\card{J}\geq 2$. 
As discussed in the proof of \reflem{lem:BinTreeRestriction}, 
 an interior cluster $K$ of  $\treeressym{J}{\treeA}$ is associated with a unique cluster $I$ of $\treeA$ such that $K = I \cap J$ and $\treeressym{J}{\childCL{I,\treeA}} \neq \crl{ I \cap J, \emptyset}$.
Hence, observe that $\cluster{\treeressym{J}{\treeA}}$ can be written as
%
{\small
\begin{align}
\hspace{-1mm}\cluster{\treeressym{J}{\treeA}} &\sqz{=} \crl{I \cap J \Big | I \in \cluster{\treeA} , \; I \cap J \neq \emptyset  } , \\
&\hspace{-7mm}\sqz{=} \crl{\!I \cap J \Big |  I \sqz{\in} \cluster{\treeA}, \treeressym{J}{\childCL{I,\treeA}}  \sqz{\neq} \crl{I \cap  J, \emptyset}\!} \sqz{\cup} \bigcup_{i \in J} \!\! \crl{i}\!.\!\!\!
\end{align}
} 
%
Accordingly, let $\treeprojCL{J}{\treeA}$ denote the set of clusters of $\treeA$ defining the interior clusters of $\treeressym{J}{\treeA}$,
% 
\begin{align}
\treeprojCL{J}{\treeA} = \crl{I \in \cluster{\treeA} \Big | \treeressym{J}{\childCL{I,\treeA}} \neq \crl{I \cap J, \emptyset}}.
\end{align}

Now, we can rewrite  \refeqn{eq:NavPathLengthP2} as 
%
{\small
\begin{align}
\card{\NavPathSym} - 1 &\sqz{=} \hspace{-2mm}\sum_{\substack{J \in \cluster{\treeB} \\ I \in \cluster{ \treeressym{J}{\treeA}}}}  
\hspace{-1mm}\walkST \Bigg({\sum_{A \in \childCL{I,\treeressym{J}{\treeA}}} \hspace{-2mm}\indicator{  \underbrace{\big(A \not \compatible \childCL{J,\treeB} \! \big)}_{\substack{
 = A \not \compatible \treeressym{I}{\childCL{J,\treeB}} \\ \text{ by \reflem{lem:EquivalentSplitCompatibility} }}}}} \Bigg), \\
%%
& \sqz{=} \hspace{-2mm} \sum_{\substack{J \in \cluster{\treeB}\\ I \in \cluster{ \treeressym{J}{\treeA}}}}  \hspace{-1mm}
\walkST{ \Bigg( \underbrace{\sum_{A \in \childCL{I,\treeressym{J}{\treeA}}} \hspace{-4mm}\indicatorfunc{A \not \compatible \treeressym{I}{\childCL{J,\treeB}} }}_{\substack{= 0 \text { if } \card{I} = 1, \\\text{ otherwise there is exactly one $\tilde{I}\in \treeprojCL{J}{\treeA}$ s.t.} \\ \childCL{I,\treeressym{J}{\treeA}} = \treeressym{J}{\childCL{\tilde{I},\treeA}} }} \!\! \!\Bigg)} \!,\\
%%%%
&\sqz{=} \hspace{0mm}\sum_{\substack{J \in \cluster{\treeB}\\ I \in  \treeprojCL{J}{\treeA}}}  \hspace{0mm}
\walkST{ \Bigg(  \underbrace{\sum_{A \in \treeressym{J}{\childCL{I,\treeA}}} \hspace{-3mm}\indicatorfunc{A \not \compatible \treeressym{I}{\childCL{J,\treeB}}}}_{\substack{= 0 \text{ for all } I \in \cluster{\treeA} \setminus \treeprojCL{J}{\treeA}\\ \text{ since } \treeressym{J}{\childCL{I,\treeA}} = \crl{I \cap J, \emptyset} }}\Bigg)}, \\
%%%%%
&\sqz{=} \hspace{0mm}\sum_{\substack{J \in \cluster{\treeB}\\I \in  \cluster{\treeA}}}  
\hspace{0mm}\walkST\underbrace{\prl{\sum_{A \in \treeressym{J}{\childCL{I,\treeA}}} \hspace{-2mm}\indicatorfunc{A \not \compatible \treeressym{I}{\childCL{J,\treeB}}}}}_{= \sumST_{\treeA,\treeB}\prl{ I, J} \text{\refeqn{eq.sumST2}}}\!, \\
%
&\sqz{=}\sum_{\substack{J \in \cluster{\treeB}\\I \in  \cluster{\treeA}}} \prl{\walkST \circ \sumST_{\treeA,\treeB}}\prl{ I, J}, \\
%
&\sqz{=} \norm{\mat{S}\prl{\treeA,\treeB}}_1.   
\end{align}
}
%

Thus, in addition to \refeqn{eq:NavPathLengthP1}, the length of any NNI navigation path in $\NavPathSet{\treeB}{\treeA}$ from $\treeA$ to $\treeB$ is equivalently given by $\norm{\mat{S}\prl{\treeA,\treeB}}_1$. 
Similarly, the length of any NNI navigation path in $\NavPathSet{\treeB}{\treeA}$ from $\treeB$ to $\treeA$ is equal to $\norm{\mat{S}\prl{\treeB,\treeA}}_1$.
Remark that for any binary tree $\treeA, \treeB \in \bintreetopspace_{\indexset}$, by  \reflem{lem:SplitCompatibilitySum}, $\norm{\mat{S}\prl{\treeA,\treeB}}_1 = \norm{\mat{S}\prl{\treeB,\treeA}}_1$.
Therefore, the length of any NNI navigation path joining $\treeA$ and $\treeB$ is equal to $\norm{\mat{S}\prl{\treeA,\treeB}}_1 = \norm{\mat{S}\prl{\treeB,\treeA}}_1$, and the result follows.
\end{proof}







\section{Additional Properties of the Discrete Dynamics for Binary Search Trees}

%Now, we will continue with a special type of binary trees, Binary Search Trees (BSTs), whose leaves are in a fixed order under any depth-first tree traversal. Thus, the set of BSTs  over a fixed finite ordered index set $\indexset$ is a subset of binary phylogenetic trees over $\indexset$, $\BSTtopspace_{\indexset} \subsetneq \bintreetopspace_{\indexset}$. A useful observation for a BST is that its clusters always corresponds to an interval of $\indexset$ (see \reffig{fig:hierarchicalrelation}). Thus, any arbitrary NNI walk at an interval cluster of BST does not guarantee preservation of leaf order, and so only one of two, left and right, NNI walks can be applicable. This leaf order preserving NNI restructuring  is known as  rotation of BSTs which is an isomorphic to diagonal-flipping of triangulations of convex polygons (see \cite{sleator_tarjan_thurston_stoc1986} for further discussion). Accordingly, the NNI graph of binary hierarchies is corresponds to the rotation graph of BSTs.  Let us now illustrate the connection between our navigation scheme and BSTs, which is in short that our navigation method in the NNI graph is also a navigation field for BSTs in the rotation graph.

\begin{definition} \label{def.BST}
For a totally ordered fixed finite set $\indexset$, a nondegenerate hierarchy $ \tree \in \bintreetopspace_{\indexset}$ is a \emph{binary search tree (BST)}\footnote{
Note that the sequence of leaves visited during any depth-first tree traversal of a BST is   the same as the order of leaf set $\indexset$.}  if every cluster $I \in \cluster{\tree}$ with the property that $\min\prl{I} < \min\prl{\compLCL{I}{\tree}}$
 satisfies $\max \prl{I}<\min\prl{\compLCL{I}{\tree}}$.
\end{definition}
%
We shall denote the set of binary search trees by $\BSTtopspace_{\indexset}$, which is, by definition, a subset of $\bintreetopspace_{\indexset}$.\footnote{The subgraph of the NNI-graph, defined  in \refsec{sec.NNIGraph}, containing only BSTs is known as the rotation graph, and the associated operations between BSTs are called \emph{rotations} \cite{sleator_tarjan_thurston_stoc1986}. } 

A distinctive feature of BSTs  is: 

\begin{remark} \label{rem:BSTcluster}
A nondegenerate hierarchy $\tree \in \bintreetopspace_{\indexset}$ over a fixed finite ordered set $\indexset$  is a BST if and only if its clusters are intervals of $\indexset$ (see \reffig{fig:hierarchicalrelation}). 
\end{remark}

We now continue with relations between the NNI control law of \refsec{sec.NNIControl} and  binary search trees. Let us start with an observation stating possible types of navigation moves in $\BSTtopspace_{\indexset}$:

\begin{lemma} \label{lem:NoTripleStepBST}
(No Type 2 Crossings for BSTs)
Let $\tree \in \BSTtopspace_{\indexset}$ be a BST  over a fixed finite ordered index set $\indexset$, and $\crl{\indexset_L, \indexset_R}$ be a bipartition of $\indexset$  whose elements are intervals of $\indexset$.  

If any cluster $\II \in \cluster{\tree}$ is incompatible with $\crl{\indexset_L,\indexset_R}$, then its sibling $\compLCL{\II}{\tree}$ is always compatible with $\crl{\indexset_L,\indexset_R}$. That is to say, there exist no  cluster of $\treetop$ Type 2 incompatible with $\crl{\indexset_L,\indexset_R}$.
\end{lemma}
%
\begin{proof}
Proof by contradiction. 

Recall that $\II$ and $\compLCL{\II}{\tree}$ are disjoint intervals of $\indexset$ (\refrem{rem:BSTcluster}) and, without loss of generality,  let  $\max \prl{\indexset_L} < \min \prl{\indexset_R}$.

Now, suppose that both clusters $\II, \compLCL{\II}{\tree} \in \cluster{\tree}$  are incompatible with $\crl{\indexset_L,\indexset_R}$.    
Hence, by \reflem{lem:SplitCompatibleEquivalence}, $\II \cap \indexset_L \neq \emptyset$,   $\II \cap \indexset_R \neq \emptyset$ and $\compLCL{\II}{\tree} \cap \indexset_L \neq \emptyset$,   $\compLCL{\II}{\tree} \cap \indexset_R \neq \emptyset$.  
Thus, $\max\prl{\II} > \min\prl{\compLCL{I}{\tree}}$ and $\min\prl{\II} < \max\prl{\compLCL{I}{\tree}}$ which is a contradiction and completes the proof. 
\end{proof}


\begin{lemma} \label{lem:BSTInvariance}
The subspace $\BSTtopspace_{\indexset}$ of $\bintreetopspace_{\indexset}$ is positive invariant for the closed loop discrete dynamical system \refeqn{eq:CLSystemModel} obeying the NNI control law  of \refsec{sec.NNIControl}. 
\end{lemma}
%
\begin{proof}
For distinct initial and desired hierarchies $\treeA \neq \treeB \in \BSTtopspace_{\indexset}$, let $K \in \CommonXSplits{\treeA,\treeB}$   be a common cluster of $\treeA$ and $\treeB$ with crossing splits and $I \in \DeepXSplit{\treeA,\treeB;K}$ be a deep incompatible cluster of $\treeA$ with $\crl{K_L,K_R} = \childCL{K,\treeB}$.

Now, the NNI move result from the control law $\vectbf{u}_{\treeB}$ on $\treeA$ at $G \in \childCL{I,\treeA}$ replaces  $I = \parentCL{G,\treeA}$ by $\grandparentCL{G,\treeA} \setminus G$ in the next hierarchy $\treeC= \NNI\prl{\treeA,G} \in \bintreetopspace_{\indexset}$. 
Note that $I$ is Type 1 since there is no Type 2 incompatibility for BSTs (\reflem{lem:NoTripleStepBST}).  
Hence, $G \subseteq K_A$ and $\compLCL{G}{\treeA}, \compLCL{I}{\treeA} \subseteq K_B$ for some $A \neq B \in \crl{L,R} $. 
Thus,  $\grandparentCL{G,\treeA} \setminus G = \compLCL{G}{\treeA} \cup \compLCL{I}{\treeA}= \grandparentCL{G,\treeA} \cap K_B$ which is another nonempty interval of $\indexset$ since clusters of $\treeA$ and $\treeB$ are intervals of the index set $\indexset$ (\refrem{rem:BSTcluster}). 
Therefore, the clusters of $\treeC$ are also intervals of $\indexset$, and so it is a BST, which completes the proof.
\end{proof}


%\begin{comment}
%
\section{An Efficiently Computable NNI Navigation Path}
%

\bigskip

%An NNI navigation path from $\treeA \in \bintreetopspace$ to $\bintreetopspace_{\indexset_L, \indexset_R}$ can be obtained with the same cost of
%$\distNav\prl{\treeA, \bintreetopspace_{\crl{\indexset_L, \indexset_R}}}$:
% 
\begin{lemma} \label{lem.NavSplitDistCost}
Let $\crl{\indexset_L, \indexset_R}$ be a bipartition of $\indexset$. 
An NNI navigation path  starting from $\treeA \in \bintreetopspace_{\indexset}$ ending in $ \bintreetopspace_{\crl{\indexset_L, \indexset_R}}$  can be computed in $\bigO{\card{\indexset}}$ time.
\end{lemma}
%
\begin{proof}
Let $\treeB \in \bintreetopspace_{\crl{\indexset_L, \indexset_R}}$.
All cluster of $\treeA$ incompatible with $\crl{\indexset_L, \indexset_R}$, i.e. $\CLXSplitSet{\treeA,\treeB; \indexset}$, can be determined in $\bigO{\card{\indexset}}$ time as discussed in the proof of \reflem{lem:NavSplitDistanceCost}.
Hence, if $\treeA \not \in \bintreetopspace_{\crl{\indexset_L,\indexset_R}}$, then a deep cluster $I \in \DeepXSplit{\treeA,\treeB; \indexset}$ incompatible with $\crl{\indexset_L, \indexset_R}$ can be found in $\bigO{\card{\indexset}}$  by a post-order traversal of $\treeA$.

Recall from \refrem{rem.NumberofNNIMoves} that $I$ and $\compLCL{I}{\treeA}$ can be replaced by $\parentCL{I,\treeA}\cap \indexset_L$ and $\parentCL{I,\treeB} \cap \indexset_R$, compatible with $\crl{\indexset_L, \indexset_R}$, after a certain number of NNI moves 
as illustrated in \reffig{fig:DeepXSplit}. 
Note that the rest of the clusters of $\treeA$ are kept the same.

Accordingly, let $\treeC \in \bintreetopspace_{\indexset}$ denote the resulting intermediate tree with cluster set
\begin{align}
\cluster{\treeC} \sqz{=} \cluster{\treeA} \sqz{\setminus} \crl{I, \compLCL{I}{\treeA}} \sqz{\cup} \crl{ \big. \parentCL{I,\treeA} \sqz{\cap} \indexset_L, \parentCL{I,\treeA} \sqz{\cap} \indexset_R}\!. \!\!
\end{align} 
Remark that $\CLXSplitSet{\treeC,\treeB; \indexset} = \CLXSplitSet{\treeA, \treeB; \indexset} \setminus\crl{I, \compLCL{I}{\treeA}}$. 
Now, instead of searching for a deep cluster in $\treeC$ starting from the root $\indexset$, using \refcor{cor:AncestorIncompatibility}, one can continue the post-order search for a deep cluster in $\treeC$ at $\parentCL{I,\treeA}$ whose children, $\parentCL{I,\treeA}\cap \indexset_L$ and $\parentCL{I,\treeB} \cap \indexset_R$, in $\treeC$ are compatible with $\crl{\indexset_L, \indexset_R}$.

In fact, observe that $\CLXSplitSet{\treeA,\treeB; \indexset} \cup \crl{\indexset}$ defines a tree-like data structure (see \reffig{fig:CrossingClusters}). 
Therefore, one can conclude that the overall construction of $\NavPath{\treeB}{\treeA}$ only requires complete post-order traversal of $\treeA$ for $\CLXSplitSet{\treeA,\treeB; \indexset}$ in $\bigO{\card{\indexset}}$ time.   
%
%Recall that the NNI control law $\vectbf{u}_{\crl{\indexset_L, \indexset_R}}$ replaces a deep single incompatible cluster $I \in \CLXSplitSet{\treeA,\treeB; \indexset}$ with a compatible one after one NNI move, and replaces deep joint incompatible siblings $I, \compLCL{I}{\treeA}$ with compatible siblings after three NNI moves.
%
%
%The crossings $\CLXSplitSet{\treeA,\treeB; \indexset}$ of $\treeA$ with $\crl{\indexset_L, \indexset_R} = \childCL{\indexset, \treeB}$ can be computed in $\bigO{\card{\indexset}}$ as discussed in the proof of \reflem{lem:CMdistanceCost}.
%
%By \reflem{lem:AncestorIncompatibility},  $\CLXSplitSet{\treeA,\treeB; \indexset}$ defines a tree structure in $\treeA$
%and enables tracking of change in cluster crossings with  $\crl{\indexset_L, \indexset_R}$ after each NNI move.
%Particularly, the NNI control law $\vectbf{u}_{\crl{\indexset_L, \indexset_R}}$ replaces a deep single incompatible cluster $I \in \CLXSplitSet{\treeA,\treeB; \indexset}$ with a compatible one after one NNI move, and replaces deep joint incompatible siblings $I, \compLCL{I}{\treeA}$ with compatible siblings after three NNI moves.
%Hence, one can efficiently obtain a sequence of trees defining $\NavPath{\crl{\indexset_L, \indexset_R}}{\treeA}$ and associated NNI moves by a complete post-order traversal of tree structure defined by $\CLXSplitSet{\treeA,\treeB; \indexset}$, in $\bigO{\card{\indexset}}$ time.   
\end{proof}

\begin{lemma}
An NNI navigation path  joining $\treeA \in \bintreetopspace_{\indexset}$ to $\treeB \in \bintreetopspace_{\indexset}$ consistent with the NNI control $\vectbf{u}_{\treeB}$ can be computed in $\bigO{\card{\indexset}^2}$ time.
\end{lemma}
%
\begin{proof}
Similar to the recursive expression of $\distNav$ \refeqn{eq:NavPathLength1}, an NNI navigation path joining $\treeA$ to $\treeB$ can 
be found using the decomposability property within a divide-and-conquer approach as follows: first obtain an NNI navigation path from $\treeA$ to $\bintreetopspace_{\crl{\indexset_L,\indexset_R}}$ in $\bigO{\card{\indexset}}$ (\reflem{lem.NavSplitDistCost}) and then find NNI navigation paths between subtrees.
Hence, this requires a pre-order traversal of $\treeB$ each of whose step costs $\bigO{\card{\indexset}}$. 
Thus, an NNI navigation path joining $\treeA$ to $\treeB$ can be recursively computed in $\bigO{\card{\indexset}^2}$ time, which completes the proof. 
\end{proof}

\begin{comment}



\section{Algorithms}

\subsection{Efficient Computation of Inclusion Relations}

\subsection{Finding an NNI Navigation Move}

\subsection{The Length of NNI Navigation Path}

\subsection{NNI Navigation Path}






\end{comment}








% Computer Society journal papers do something a tad strange with the very
% first section heading (almost always called "Introduction"). They place it
% ABOVE the main text! IEEEtran.cls currently does not do this for you.
% However, You can achieve this effect by making LaTeX jump through some
% hoops via something like:
%
%\ifCLASSOPTIONcompsoc
%  \noindent\raisebox{2\baselineskip}[0pt][0pt]%
%  {\parbox{\columnwidth}{\section{Introduction}\label{sec:introduction}%
%  \global\everypar=\everypar}}%
%  \vspace{-1\baselineskip}\vspace{-\parskip}\par
%\else
%  \section{Introduction}\label{sec:introduction}\par
%\fi
%
% Admittedly, this is a hack and may well be fragile, but seems to do the
% trick for me. Note the need to keep any \label that may be used right
% after \section in the above as the hack puts \section within a raised box.



% The very first letter is a 2 line initial drop letter followed
% by the rest of the first word in caps (small caps for compsoc).
% 
% form to use if the first word consists of a single letter:
% \IEEEPARstart{A}{demo} file is ....
% 
% form to use if you need the single drop letter followed by
% normal text (unknown if ever used by IEEE):
% \IEEEPARstart{A}{}demo file is ....
% 
% Some journals put the first two words in caps:
% \IEEEPARstart{T}{his demo} file is ....
% 
% Here we have the typical use of a "T" for an initial drop letter
% and "HIS" in caps to complete the first word.

%\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
%for IEEE Computer Society journal papers produced under \LaTeX\ using
%IEEEtran.cls version 1.7 and later.

% You must have at least 2 lines in the paragraph with the drop letter
% (should never be an issue)
%I wish you the best of success.
%
%\hfill mds
% 
%\hfill January 11, 2007





 

  









           



% use section* for acknowledgement
\ifCLASSOPTIONcompsoc
  % The Computer Society usually uses the plural form
  \section*{Acknowledgments}
\else
  % regular IEEE prefers the singular form
  \section*{Acknowledgment}
\fi


%The authors would like to thank...

This work was funded in part by the Air Force Office of Science
Research under the MURI FA9550-10-1-0567.


% Can use something like this to put references on a page
% by themselves when using endfloat and the captionsoff option.
\ifCLASSOPTIONcaptionsoff
  \newpage
\fi



% trigger a \newpage just before the given reference
% number - used to balance the columns on the last page
% adjust value as needed - may need to be readjusted if
% the document is modified later
%\IEEEtriggeratref{8}
% The "triggered" command can be changed if desired:
%\IEEEtriggercmd{\enlargethispage{-5in}}

% references section

% can use a bibliography generated by BibTeX as a .bbl file
% BibTeX documentation can be easily obtained at:
% http://www.ctan.org/tex-archive/biblio/bibtex/contrib/doc/
% The IEEEtran BibTeX style support page is at:
% http://www.michaelshell.org/tex/ieeetran/bibtex/
%\bibliographystyle{IEEEtran}
% argument is your BibTeX string definitions and bibliography database(s)
%\bibliography{IEEEabrv,../bib/paper}
%
% <OR> manually copy in the resultant .bbl file
% set second argument of \begin to the number of references
% (used to reserve space for the reference number labels box)

%\begin{thebibliography}{1}
%
%\bibitem{IEEEhowto:kopka}
%%This is an example of a book reference
%H. Kopka and P.W. Daly, \emph{A Guide to {\LaTeX}}, third ed. Harlow, U.K.: Addison-Wesley, 1999.
%
%
%
%%Again, see the IEEEtrans_HOWTO.pdf for several more bibliographical examples. Also, more style examples
%%can be seen at http://www.computer.org/author/style/transref.htm
%\end{thebibliography}



\bibliographystyle{IEEEtran} % use IEEEtran.bst style
\bibliography{IEEEabrv,NNIWalk}


% biography section
% 
% If you have an EPS/PDF photo (graphicx package needed) extra braces are
% needed around the contents of the optional argument to biography to prevent
% the LaTeX parser from getting confused when it sees the complicated
% \includegraphics command within an optional argument. (You could create
% your own custom macro containing the \includegraphics command to make things
% simpler here.)
%\begin{biography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{mshell}}]{Michael Shell}
% or if you just want to reserve a space for a photo:

%\begin{IEEEbiography}{Michael Shell}
%Biography text here.
%\end{IEEEbiography}
%
%% if you will not have a photo at all:
%\begin{IEEEbiographynophoto}{John Doe}
%Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.
%\end{IEEEbiographynophoto}
%
%% insert where needed to balance the two columns on the last page with
%% biographies
%%\newpage
%
%\begin{IEEEbiographynophoto}{Jane Doe}
%Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.Biography text here.
%\end{IEEEbiographynophoto}

% You can push biographies down or up by placing
% a \vfill before or after them. The appropriate
% use of \vfill depends on what kind of text is
% on the last page and whether or not the columns
% are being equalized.

%\vfill

% Can be used to pull up biographies so that the bottom of the last one
% is flush with the other column.
%\enlargethispage{-5in}



% that's all folks
\end{document}




header.tex


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Comments & Remarks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand \kodcom[1] { \marginpar{ %\scriptsize
 \tiny \textsf{ #1}}}

\newcommand{\ToDo}[1]		{{\color{red}\textbf{ToDo:}} #1} % ToDo Remarks

 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%% Theorem Environments 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%	\theoremstyle{plain}
%	\newtheorem{claim}{Claim}
%	\newtheorem{assumption}{A}
%	\newtheorem{theorem}{Theorem}[section]
%	\newtheorem{lemma}[theorem]{Lemma}
%	\newtheorem{proposition}[theorem]{Proposition}
%	\newtheorem{corollary}[theorem]{Corollary}
%	\newtheorem{conjecture}[theorem]{Conjecture}
	
%	\theoremstyle{definition}
%	\newtheorem{definition}[theorem]{Definition}
%	\newtheorem{example}[theorem]{Example}
%	\newtheorem{remark}[theorem]{Remark}


%	\theoremstyle{plain}
	\newtheorem{claim}{Claim}
	\newtheorem{assumption}{A}
	\newtheorem{theorem}{Theorem}
	\newtheorem{lemma}{Lemma}
	\newtheorem{proposition}{Proposition}
	\newtheorem{corollary}{Corollary}
	\newtheorem{conjecture}{Conjecture}
	
%	\theoremstyle{definition}
	\newtheorem{definition}{Definition}
	\newtheorem{example}{Example}
	\newtheorem{remark}{Remark}
 
	\newenvironment{proof}[1][Proof]{\begin{trivlist}
		\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
%	\newenvironment{definition}[1][Definition]{\begin{trivlist}
%		\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
%	\newenvironment{example}[1][Example]{\begin{trivlist}
%		\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
%	\newenvironment{remark}[1][Remark]{\begin{trivlist}
%		\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

	\newcommand{\qed}{\nobreak \ifvmode \relax \else
      	\ifdim\lastskip<1.5em \hskip-\lastskip
      	\hskip1.5em plus0em minus0.5em \fi \nobreak
      	\vrule height0.75em width0.5em depth0.25em\fi}
      

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Enclosing Brackets
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \newcommand{\prl}[1] 		{\!\left(#1\right)}
    \newcommand{\brl}[1] 		{\left[ #1 \right] }
    \newcommand{\crl}[1] 		{\left\{ #1 \right\} }
    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
%% Useful Mathematical Symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Common Sets/Domains/Codomains
    \newcommand{\R}             {\mathbb{R}} % Reals
 	\newcommand{\N}         		{\mathbb{N}} % Natural Numbers
 	\newcommand{\Sp}        		{\mathbb{S}} % Sphere
 	\newcommand{\C}      		{\mathbb{C}} % Complex Numbers
% Common Functions    
    \newcommand{\acot} 			{\mathrm{acot}}
    \newcommand{\atan} 			{\mathrm{atan}}
    \newcommand{\asin} 			{\mathrm{asin}}
	\newcommand{\acos} 			{\mathrm{acos}}
    \newcommand{\sign} 			{\mathrm{sign}} 
	\newcommand{\cl}[1]			{\overline{#1}} % closure
    \newcommand{\bd}				{\partial} %boundary  	
  	\newcommand{\card}[1]		{\left| #1 \right|} % cardinality
	\newcommand{\norm}[1] 		{\left \| #1 \right \|} 
    \newcommand{\absval}[1] 		{\left | #1 \right |}
    \newcommand{\twonorm}[1] 	{\parallel #1 \parallel_{2}}
    \newcommand{\proj}[2]		{\pi_{#1} \prl{ #2}} % projection
    \newcommand{\innerprod}[2]	{\left \langle #1 , #2 \right \rangle}
    \newcommand{\dotprod}[2]    { #1 \cdot #2}
    \newcommand{\vectprod}[2]    { \tr{#1} #2}
    \newcommand{\tr}[1]         {{#1}^\mathrm{T}}
    \newcommand{\kernel}[1]        {ker\left(#1\right)} 
%    \newcommand{\ldist} [2] { \delta_l(#1,#2)}
%    \newcommand{\compdist} [2] { \delta_j(#1,#2)}
	%\newcommand{\argmin}{\operatornamewithlimits{argmin}}
	\newcommand{\argmin}{\operatornamewithlimits{arg\ min}} % with space
	\newcommand{\argmax}{\operatornamewithlimits{arg\ max}} % with space
	\newcommand{\simdiff}       {\Delta}

%% Derivtives etc.

    \newcommand{\deriv}[2]			{\frac{\text{d} #1}{\text{d} #2} }
    \newcommand{\ddt}[1] 			{\frac{\text{d}}{\text{d}t} #1 }
    \newcommand{\dddt}[1] 			{\frac{\text{d}^2}{\text{d}t^2} \prl{#1} }
    \newcommand{\Deriv}[2]			{\frac{\delta #1}{\delta #2} }
    \newcommand{\bigD}[1] 			{\mathcal{D} #1 }

    
%% Matrix and vector
	\newcommand{\mat}[1] 		{\mathrm{\mathbf{#1}}}
	\newcommand{\matul}[1] 		{\underline{\underline{\mat{#1}}}}
	\newcommand{\set}[1]  		{\mathcal{#1}}
	\newcommand{\vect}[1] 		{\mathrm{#1}}
	\newcommand{\vectbf}[1]		{\mathrm{\mathbf{#1}}}
	\newcommand{\vectul}[1] 	    {\underline{\vect{#1}}}


%% Miscellaneous Arrays
    \newcommand{\threevecbig}[3]{\left[\begin{array}{c}
          #1\\[2.5ex] #2\\[2.5ex] #3 \\
        \end{array} 
      \right]}
    \newcommand{\fourvecbig}[4]{\left[\begin{array}{c}
          #1\\[2.5ex] #2\\[2.5ex] #3 \\[2.5ex] #4\\
        \end{array} 
      \right]}
    \newcommand{\fivevecbig}[5]{\left[\begin{array}{c}
          #1\\[2.5ex] #2\\[2.5ex] #3 \\[2.5ex] #4\\[2.5ex] #5\\
        \end{array} 
      \right]}

    \newcommand{\twovec} [2] { \left[ \begin{array}{c} 
          #1 \\ #2 \end{array} \right] }
    
    \newcommand{\twovect} [2] { [\;#1, \;#2\;] }
    \newcommand{\twovecT} [2] { \left[ \begin{array}{ccc} 
          #1, & #2 \end{array} \right] }
    
    \newcommand{\threevec} [3] { \left[ \begin{array}{c} 
          #1 \\ #2 \\ #3 \end{array} \right] }
    
    \newcommand{\threevecT} [3] { \left[ \begin{array}{ccc} 
          #1, & #2, & #3 \end{array} \right] }
    
    \newcommand{\fourvec} [4] { \left[ \begin{array}{c} 
          #1 \\ #2 \\ #3 \\ #4 \end{array} \right] }
    
    \newcommand{\fourvect} [4] { [\;#1, \;#2,\;#3,\;#4\;]^T }
    \newcommand{\fourvecT} [4] { \left[ \begin{array}{cccc} 
          #1, & #2, & #3, & #4 \end{array} \right] }
    
    \newcommand{\fivevect}[5] { [\;#1,\;#2,\;#3,\;#4\;#5\;]^T } 
    
    \newcommand{\twomatrix}[4]{ \left[\begin{array}{cc}
                                   #1 & #2\\
                                   #3 & #4\\
                                 \end{array}
                           \right]}


%% References

    \newcommand{\refeqn}[1]			{(\ref{#1})}
    \newcommand{\reffig}[1]			{Figure \ref{#1}}
    \newcommand{\refsec}[1]			{Section \ref{#1}}
    \newcommand{\refapp}[1]			{Appendix \ref{#1}}
	\newcommand{\reftab}[1]			{Table \ref{#1}}
	\newcommand{\refthm}[1]			{Theorem \ref{#1}}
	\newcommand{\refprop}[1]		{Proposition \ref{#1}}
	\newcommand{\refcor}[1]			{Corollary \ref{#1}}
	\newcommand{\reflem}[1]			{Lemma \ref{#1}}
	\newcommand{\refdef}[1]			{Definition \ref{#1}}
	\newcommand{\refas}[1]			{Assumption \ref{#1}}
	\newcommand{\refrem}[1]			{Remark \ref{#1}}

%% Some useful symbols:

    \newcommand{\dotol}[1]			{\dot {\ol #1}}
    \newcommand{\bfm}				{\boldmath}
    \newcommand{\ol}				    {\overline}
    \newcommand{\concat}            	{+\!\!\!\! +\,} %{\mathbin{\|}}%
    \newcommand{\df}					{  \: {\mathbf := }  \: }
    \newcommand{\ldf}				{  \: {\mathbf := }  \: }
    \newcommand{\rdf}                {  \: {\mathbf =: } \:  }
    \newcommand{\en}					{ \;\; }
    \newcommand{\sqz}[1]            {\! #1 \!}
    \newcommand{\ecap}              {\Cap}
    





%% Shorthands for stuff
   \def \zero {0}

%% Relational symbols
   
   \def \implies {\rightarrow}
   \def \logicand {\wedge}
   \def \logicor {\vee}
   \def \logicnot {\urcorner}
   \newcommand{\THEN}{\;\Rightarrow\;}
   \newcommand{\IFF}{\;\Leftrightarrow\;}
   \newcommand{\minus}{\smallsetminus}
   \newcommand{\field}[1]{\mathbb{#1}}
   \newcommand{\reals}{\field{R}}

% Miscellaneous symbols
	\newcommand{\tickYes}{\checkmark}
	\newcommand{\tickNo}{\hspace{1pt}\ding{55}}

%%special fonts and characters
%\newcommand{\actson}{\curvearrowright}
%\newcommand{\mb}[1]{\mathbf{#1}}
%\newcommand{\fat}[1]{\mathds{#1}}
%\newcommand{\hsm}[1]{\mathcal{#1}}
%\renewcommand{\AA}{\fat{A}}
%\newcommand{\CC}[1]{\hsm{C}\left(#1\right)}
%\newcommand{\EE}{\fat{E}}
%\newcommand{\NN}{\fat{N}}
%\newcommand{\ZZ}{\fat{Z}}
%\newcommand{\RR}{\fat{R}}
%\newcommand{\RRplus}{\RR_{_{\geq 0}}}
%\renewcommand{\SS}{\fat{S}}
%
%%logic

%
%%parentheses and sets
%\newcommand{\ep}{\hfill $\square$}
%\renewcommand{\span}[1]{\mathrm{span}_{\Fat{R}}\left\{#1\right\}}
%\newcommand{\gen}[1]{\langle #1\rangle}
%\newcommand{\cl}[1]{\overline{#1}}
%\newcommand{\card}[1]{\left|#1\right|}
%\newcommand{\bd}{\partial}
%\newcommand{\inv}{^{{\scriptscriptstyle -1}}}
%
%%specifics
%\newcommand{\conf}[2]{\mathrm{Conf}\!\left(#1,#2\right)}
%\newcommand{\rootv}{\emptyset}
%\newcommand{\TT}[1]{\hsm{T}_{#1}}
%\newcommand{\TTbar}[1]{\bar{\hsm{T}}_{#1}}
%
%%\setlength{\parindent}{0cm}
%

% Algorithms
\newcommand{\bigO}[1] 			{\mathrm{O}\prl{#1}}
\newcommand{\algif}				{\textbf{if }}
\newcommand{\algendif}			{\textbf{endif}}
\newcommand{\algelse}			{\textbf{else }}
\newcommand{\algelseif}			{\textbf{elseif }}
\newcommand{\algthen}			{\textbf{then }}
\newcommand{\algfunc}           	{\textbf{function }}
\newcommand{\algreturn}			{\textbf{return}}
\newcommand{\algswitch}         	{\textbf{switch }}
\newcommand{\algcase}			{\textbf{case }}
\newcommand{\algfor}				{\textbf{for }}
\newcommand{\algendfor} 			{\textbf{endfor}}
\newcommand{\algeach}			{\textbf{each }}
\newcommand{\algcomment}[1]     	{\textit{\% #1}}

\newcommand{\LineNumberSizeAlg} 	{\small}
\newcommand{\scriptsizeAlg}		{\normalsize}%\footnotesize}

notation.tex

%% Kod New

\def \purt { \mathcal{I} } % a partition of the index set J
\newcommand { \parts}[1]{ {\tt Part}\left[ #1 \right] } 
\def \cRdJ { \conf{\R^d}{J}  }
\def \mathscr {\mathcal} % I don't seem to have the \mathscr series 

\def \Cbas { \mathcal{B}_C}  % Cluster centroids basis

%%% General notational definitions
%


%% Tree Space Related
\newcommand{\treespace}   		 {\mathcal{T}}
\newcommand{\treetopspace}       {\mathcal{T}}%{\overline{\mathcal{T}}}
\newcommand{\bintreetopspace}    {\mathcal{BT}} % {\overline{\mathcal{BT}}}
\newcommand{\BSTtopspace}       {\mathcal{BST}}
\newcommand{\tree}        		{\tau}
\newcommand{\treeA}             {\sigma}
\newcommand{\treeB}             {\tau}
\newcommand{\treeC}             {\gamma}
\newcommand{\treetop}			{\tau}
\newcommand{\bintreetop}        {\tau^b}
\newcommand{\edgesets}     		{\varepsilon}
\newcommand{\edgelengthset} 	{\Sigma}
\newcommand{\leafset}     		{\mathit{X}}
\newcommand{\treeset}[1]       {\tree^{#1} = (\leafset, \edgeset^{#1}, \edgelengthset{#1})}
\newcommand{\interior}    		{i}
\newcommand{\leaf}        		{l}
\newcommand{\edge} 	   			{e}
\newcommand{\ntree} 			{$n$-tree}
\newcommand{\northant} 		{$n$-orthant} 
\newcommand{\edgesplit}        {s}
\newcommand{\splitset}[1] 		{ #1 \;|\; \overline{#1} }
\newcommand{\geodesic}[2]  	{\Gamma(#1, #2)}
\newcommand{\geodesicleaf}[2]  {\Gamma_l(#1, #2)} 
\newcommand{\shortestpath}[2]  {\Gamma(#1,#2)}
\newcommand{\straightline}[2]  {\Gamma_S(#1,#2)}
\newcommand{\newshortestpath}[2] {\tilde{\Gamma}(#1, #2)}
\newcommand{\traveltime}		{\lambda}
\newcommand{\orthantset}		{\mathbb{O}} 
\newcommand{\orthant}			{\mathcal{O}} 
\newcommand{\ortreal}[1]		{\left[#1\right]}
\newcommand{\ortvect}[1]       {\left< #1\right>}
\newcommand{\pathspace}[2]    	{\mathscr{P}(#1,#2)}
\newcommand{\newpathspace}[2]   {\tilde{\mathscr{P}}(#1,#2)}
%\newcommand{\CMat}[2] 		   	{\mat{C}\prl{#1,#2}}  % Compatibility Matrix
%\newcommand{\XMat}[2]            {\mat{X}\prl{#1, #2}}  % Crossing Matrix
\newcommand{\CMat}              {\mat{C}}
\newcommand{\XMat}              {\mat{X}}
\newcommand{\edgebijection}   	{b}
\newcommand{\properbijection}  {b^*}
\newcommand{\edgelabel}			{\mathcal{L}}
\newcommand{\crossmap}			{U}  
\newcommand{\pathspacepath}[1]  {\mathcal{P}(#1)}

 
\newcommand{\indexset}			{S}
\newcommand{\vertex}            {v}
\newcommand{\vertexset}[1]		{\mathbf{V}\left(#1\right)}
\newcommand{\edgeset}[1]		{\mathbf{E}\left(#1\right)}


%%  Relations - Compatibility
\newcommand{\compatible}  		{\bowtie} 
\newcommand{\cross}	 			{\otimes} 

% Different metrics
\newcommand{\dist} 				{\mathit{d}}
\newcommand{\distNNI}          	{\dist_{NNI}} % Nearest Neighbor Interchange (NNI) Distance
\newcommand{\distRF}           	{\dist_{RF}}  % Robinson-Foulds (symmetric difference) Distance
\newcommand{\distMS}             {\dist_{MS}}  % Matching Split Distance 
\newcommand{\distCM}             {\dist_{CM}}  % Crossing Distance
\newcommand{\distCC}             {\dist_{CC}}  % Cluster-Cardinality Distance
\newcommand{\distNav}            {\dist_{Nav}} % NNI Navigation Distance 
\newcommand{\distMat} 			{\mat{D}} % Distance Matrix

 
%% Configuration Space Related
\newcommand{\confg}[3]			{\mathrm{Conf}_{#1} \! \left( #2,#3 \right)}
\newcommand{\conf}[2]			{\mathrm{Conf}\!\left(#1,#2\right)}
\newcommand{\ctrd}[1]			{\mathrm{c}\left( #1 \right)}
\newcommand{\ctrdsep}[1]			{\mathrm{s} \left( #1 \right)}
\newcommand{\ctrdmid}[1]			{\mathrm{m} \left( #1 \right)}
\newcommand{\ctrdS}[2]			{\mathrm{c}_{#1}\left(#2 \right)}
\newcommand{\ctrdmidS}[2]		{\mathrm{m}_{#1} \left( #2 \right)}
\newcommand{\ctrdsepS}[2]		{\mathrm{s}_{#1} \left( #2 \right)}
\newcommand{\diam}[1] 			{\mathrm{diam}\left( #1 \right)}
\newcommand{\radius}            {r}
\newcommand{\uradius}[2]        {\overline{\radius}_{#1}\prl{#2}}
\newcommand{\domainE}			{\mathcal{D}_E}
\newcommand{\goalA}				{\mathcal{G}_A}

%Hierarchically-Clustered Particle Navigation - Controller
\newcommand{\f}                 {f_{\tau}}
\newcommand{\g}                 {g_{\tau}}
\newcommand{\h}[1]              {h_{#1}}   
\newcommand{\rank}[1]			{\mathrm{rank}\left( #1\right)}
\newcommand{\scaleratefunc}         {\xi}
\newcommand{\scalesym}			{\rho}
\newcommand{\scalerate}         {\dot{\rho}}
\newcommand{\polygon}           {\mathtt{P}}


%%Clustering Map
\newcommand{\treemapC} 			{p} % tree map from configuration space
\newcommand{\treemapD} 			{\hat{p}}
\newcommand{\treetopmap} 		{\pi_{\tau}}
\newcommand{\distmap}			{d}
\newcommand{\hopf}				{h}
\newcommand{\CLset}             {\mathscr{C}}
\newcommand{\cluster}[1] 		{\mathscr{C} \left( #1 \right ) }
\newcommand{\intcluster}[1]     {\mathscr{C}_{int} \prl{#1} }
\newcommand{\kcluster}[2] 		{\mathcal{C}_{#1} \left( #2 \right ) }
\newcommand{\splt}[1] 			{\mathrm{split} \left ( #1\right )}
\newcommand{\Split}[1] 			{Split\left ( #1\right )}
\newcommand{\SplitJoin}[1] 		{\mathcal{P}\left( #1\right)}
\newcommand{\Partition}[2]      {\mathscr{P}_{#1}\left ( #2\right )}
\newcommand{\PowerSet}[1]       {\mathcal{P}\prl{#1}}
\newcommand{\strata}[1] 		    {\mathfrak{S} \prl{#1} }
\newcommand{\strataO}[1] 		{\mathfrak{S}_o\left ( #1 \right)}
\newcommand{\strataC}[1] 		{\mathfrak{S}_{cl}\left ( #1 \right)}
\newcommand{\stratum}[1] 		    {\mathfrak{S} \prl{#1} }
\newcommand{\stratumO}[1] 		{\mathfrak{S}_o\left ( #1 \right)}
\newcommand{\stratumC}[1] 		{\mathfrak{S}_{cl}\left ( #1 \right)}
\newcommand{\stratumL}[2]        {\mathfrak{S}_{#1}\prl{#2}}

\newcommand{\shrink}[2]    		{S_{#1}\left( #2\right)}


%% Hieararchical Relations

%\newcommand{\parentCL}[1]		{Parent \left( #1 \right)}
%\newcommand{\childCL}[1]		{Children\left( #1\right)}
%\newcommand{\ancestorCL}[1]     {Ancestor \left( #1\right )}
%\newcommand{\descendantCL}[1]   {Descendant \left( #1\right )}
\newcommand{\parentCL}[1]		{\mathrm{Pr} \left( #1 \right)}
\newcommand{\grandparentCL}[1]	{\mathrm{Pr}^2\prl{#1}}
\newcommand{\grandchildset}[1]   {\mathcal{G}\prl{#1}}
\newcommand{\childCL}[1]		    {\mathrm{Ch}\prl{#1}}
\newcommand{\grandchildCL}[1]   {\mathrm{Ch}^2\prl{#1}}
\newcommand{\ancestorCL}[1]     {\mathrm{Anc} \left( #1\right )}
\newcommand{\commonancestorCL}[1] {\mathrm{CAnc} \prl{#1}}
\newcommand{\cancCL}[3]          {\prl{#1  {\wedge}  #2}_{#3}}
\newcommand{\descendantCL}[1]   {\mathrm{Des} \left( #1\right )}
\newcommand{\complementCL}[1]   {{#1}^{C}}
\newcommand{\complementLCL}[1]  {{#1}^{LC}}
\newcommand{\compLCL}[2]        {{#1}^{-#2}}
\newcommand{\lv}  				{ \ell } % The level or ``depth'' of the partition in the tree
\newcommand{\Lv}  				{ L } % The  ``depth'' of the complete  tree
\newcommand{\depth}[1]          {\lv_{#1}}

\newcommand{\linkage}           {\zeta} 
\newcommand{\monotoneLinkage}   {\mathcal{ML}}

\newcommand{\HAC}              {\mathtt{HAC}}

% Operators
\newcommand{\TpS}[1]            {\mat{P}\left( #1\right)}
\newcommand{\pRS}				{\vect{v}} % projection of R^d-{0} onto S^{d-1}
\newcommand{\treeres}[1]        {res_{#1}}
\newcommand{\treeressym}[2]     {{#2}\big|_{#1}}
\newcommand{\treeproj}[1]       {\pi_{#1} }
\newcommand{\treeprojfunc}[2]   {\treeproj{#1}\prl{#2}}
\newcommand{\treeprojCL}[2]      {\mathscr{C}_{#1}\prl{#2}}
\newcommand{\treecut}[1]		   	{\chi_{#1}}
\newcommand{\treecutfunc}[2]     {\treecut{#1}\prl{#2}}
\newcommand{\indicatorfunc}[1]   {\mathbbm{1}\prl{#1}} 
\newcommand{\indicator}          {\mathbbm{1}}
 %{\mathsf{1}\prl{#1}}
\newcommand{\sumST}           	{\kappa}
\newcommand{\sumSTfunc}[1]       {\sumST\prl{#1}}
\newcommand{\walkST}             {\eta}
\newcommand{\walkSTfunc}[1]      {\walkST \prl{#1}}
\newcommand{\Xsum}[1]            {\Psi_{#1}}

\newcommand{\polyvar}      	{q}

% Stability Analysis
\newcommand{\hierconst} 			{\rho} % A hierarchical constant of Lyapunov function  
\newcommand{\CommonXSplits}[1]         {\mathcal{K}\prl{#1}} % set of common clusters with different splits
\newcommand{\CommonXCL}          {K} % a common cluster with a different split
\newcommand{\commonCL}           {K}
\newcommand{\desCL}				{D}
\newcommand{\ancCL}				{A}
\newcommand{\CLXSplitSet}[1]     {\mathcal{I}\prl{#1}}
\newcommand{\CLXSplit}           {I}
\newcommand{\CLXSplitST}[1] 	 	{\mathcal{I}_{SJ} \prl{#1}}
\newcommand{\DeepXSplit}[1]      {\mathcal{D}\prl{#1}}
 

\newcommand{\NNIGraph}[1]      {\mathcal{N}_{#1}}
\newcommand{\NNIgraph}      	   {\mathcal{N}}
\newcommand{\NNIedge}[2]          {E_{#1}\prl{#2}}
\newcommand{\NNIedgeset}       {\mathcal{E}}
\newcommand{\NNIDedge}         {\widehat{\mathcal{E}}}
\newcommand{\NNIface}[2]         {F_{#1}\prl{#2}}
\newcommand{\st}               {\mathrm{st}} 
 
 
 %Algorithm related 
% \newcommand{\NNIGraph}[1]      	{\mathcal{G}_{#1}}
 \newcommand{\NNI}              	{\text{NNI}}
 \newcommand{\MemberOf}         	{\text{MemberOf}}
 \newcommand{\NavigationNNI}    	{\text{NavPathNNI}}
 \newcommand{\findNNIWalk}      	{\text{findNNIWalk}}
 \newcommand{\NNINavPath}        {\text{NNINavPath}}
 \newcommand{\NNINavLength}      {\text{NNINavLength}}
 \newcommand{\leafDF}[1]         {g_{#1}}
 \newcommand{\leafDFfunc}[2]     {\leafDF{#1}\prl{#2}} 
 \newcommand{\algleafDF}       	{\text{leafDForder}}
 \newcommand{\algCLRange}    	{\text{CLRange}}
 \newcommand{\algCrossingType}  	{\text{CrossingType}}
 \newcommand{\algSTNNIWalk}      {\text{SJNNIWalk}}
 \newcommand{\algTreeProj}       {\text{TreeProj}}
 \newcommand{\algCommonXCL}      {\text{CommonXCL}}
 \newcommand{\algNNINavWalk}		{\text{NNINavWalk}}
 \newcommand{\algNNINavPath}    	{\text{NNINavPath}}
 \newcommand{\algNNINavLength}   {\text{NNINavLength}}
 \newcommand{\algSplitNavLength} {\text{SplitNavLength}}
  
 \newcommand{\rootCL}[1]              {\text{root}\prl{#1}}
 \newcommand{\II}               	{I} % arbitrary cluster
 \renewcommand{\AA}               	{A} % an ancestor cluster
 \newcommand{\DD}				{D} % a descendant cluster
 \newcommand{\KK}              	{K} 
 \newcommand{\LL}              	{L}
 \newcommand{\RR}               	{R}
 \newcommand{\NN}               	{N}
 \newcommand{\VV} 				{V}
 \newcommand{\XX}                {X}
 \newcommand{\YY}                {Y}
 \newcommand{\ZZ}                {Z}
 \newcommand{\NavPath}[2]  		{\Gamma_{#1}\prl{#2}} 
 \newcommand{\NavPathSym}        {\zeta}
 \newcommand{\NavPathSet}[2]     {\Gamma\prl{#2,#1}}
 \newcommand{\NavLength}		{\tilde{d}_{Nav} }
 \newcommand{\NavLengthfunc}[1] {\NavLength\prl{#1}} 
 
 
 %\newcommand{\ecap}        {\cap \hspace{-2.5mm} \cdot \hspace{2mm}}
body_outline.bbl
\begin{thebibliography}{10}
\providecommand{\url}[1]{#1}
\csname url@rmstyle\endcsname
\providecommand{\newblock}{\relax}
\providecommand{\bibinfo}[2]{#2}
\providecommand\BIBentrySTDinterwordspacing{\spaceskip=0pt\relax}
\providecommand\BIBentryALTinterwordstretchfactor{4}
\providecommand\BIBentryALTinterwordspacing{\spaceskip=\fontdimen2\font plus
\BIBentryALTinterwordstretchfactor\fontdimen3\font minus
  \fontdimen4\font\relax}
\providecommand\BIBforeignlanguage[2]{{%
\expandafter\ifx\csname l@#1\endcsname\relax
\typeout{** WARNING: IEEEtran.bst: No hyphenation pattern has been}%
\typeout{** loaded for the language `#1'. Using the pattern for}%
\typeout{** the default language instead.}%
\else
\language=\csname l@#1\endcsname
\fi
#2}}

\bibitem{robinson_foulds_mb1981}
D.~F. Robinson and L.~R. Foulds, ``Comparison of phylogenetic trees,''
  \emph{Mathematical Biosciences}, vol.~53, no. 1-2, pp. 131 -- 147, 1981.

\bibitem{day_joc1985}
W.~H.~E. Day, ``Optimal algorithms for comparing trees with labeled leaves,''
  \emph{Journal of Classification}, vol.~2, pp. 7--28, 1985,
  10.1007/BF01908061.

\bibitem{bogdanowicz_giaro_TCBB2012}
D.~Bogdanowicz and K.~Giaro, ``Matching split distance for unrooted binary
  phylogenetic trees,'' \emph{Computational Biology and Bioinformatics,
  IEEE/ACM Transactions on}, vol.~9, no.~1, pp. 150--160, jan.-feb. 2012.

\bibitem{lin_rajan_moret_TCBB2012}
Y.~Lin, V.~Rajan, and B.~Moret, ``A metric for phylogenetic trees based on
  matching,'' \emph{Computational Biology and Bioinformatics, IEEE/ACM
  Transactions on}, vol.~9, no.~4, pp. 1014--1022, july-aug. 2012.

\bibitem{robinson_jct1971}
D.~Robinson, ``Comparison of labeled trees with valency three,'' \emph{Journal
  of Combinatorial Theory, Series B}, vol.~11, no.~2, pp. 105 -- 119, 1971.

\bibitem{moore_goodman_barnabas_jtb1973}
G.~Moore, M.~Goodman, and J.~Barnabas, ``An iterative approach from the
  standpoint of the additive hypothesis to the dendrogram problem posed by
  molecular data sets,'' \emph{Journal of Theoretical Biology}, vol.~38, no.~3,
  pp. 423 -- 457, 1973.

\bibitem{allen_steel_AC2001}
B.~L. Allen and M.~Steel, ``Subtree transfer operations and their induced
  metrics on evolutionary trees,'' \emph{Annals of Combinatorics}, vol.~5, pp.
  1--15, 2001, 10.1007/s00026-001-8006-8.

\bibitem{felsenstein2004}
J.~Felsenstein, \emph{Inferring Phylogenies}.\hskip 1em plus 0.5em minus
  0.4em\relax Suderland, USA: Sinauer Associates, 2004.

\bibitem{DasguptaEtAL_DIMACS1997}
B.~Dasgupta, X.~He, T.~Jiang, M.~Li, J.~Tromp, and L.~Zhang, ``On computing the
  nearest neighbor interchange distance,'' in \emph{In Proc. DIMACS Workshop on
  Discrete Problems with Medical Applications}.\hskip 1em plus 0.5em minus
  0.4em\relax Press, 1997, pp. 125--143.

\bibitem{li_tromp_zhang_jtb1996}
M.~Li, J.~Tromp, and L.~Zhang, ``On the nearest neighbour interchange distance
  between evolutionary trees,'' \emph{J. Theor. Biol}, pp. 463--467, 1996.

\bibitem{culik_wood_IPL1982}
K.~CulikII and D.~Wood, ``A note on some tree similarity measures,''
  \emph{Information Processing Letters}, vol.~15, no.~1, pp. 39 -- 42, 1982.

\bibitem{brown_day_JOC1984}
E.~K. Brown and W.~H.~E. Day, ``A computationally efficient approximation to
  the nearest neighbor interchange metric,'' \emph{Journal of Classification},
  vol.~1, pp. 93--124, 1984, 10.1007/BF01890118.

\bibitem{bryant_DIMACS2003}
D.~Bryant, ``A classification of consensus methods for phylogenetics,''
  \emph{DIMACS series in discrete mathematics and theoretical computer
  science}, vol.~61, pp. 163--184, 2003.

\bibitem{margush_mcmorris_BMB1981}
T.~Margush and F.~R. McMorris, ``Consensus n-trees,'' \emph{Bulletin of
  Mathematical Biology}, vol.~43, no.~2, pp. 239--244, 1981.

\bibitem{barthelemy_mcmorris_JC1986}
J.-P. Barth{\'e}lemy and F.~McMorris, ``The median procedure for n-trees,''
  \emph{Journal of Classification}, vol.~3, no.~2, pp. 329--334, 1986.

\bibitem{rohlf_MB1982}
F.~James~Rohlf, ``Consensus indices for comparing classifications,''
  \emph{Mathematical Biosciences}, vol.~59, no.~1, pp. 131--144, 1982.

\bibitem{bremer_C1990}
K.~Bremer, ``Combinable component consensus,'' \emph{Cladistics}, vol.~6,
  no.~4, pp. 369--372, 1990.

\bibitem{arslanEtAl_Allerton2012}
\BIBentryALTinterwordspacing
O.~Arslan, D.~P. Guralnik, and D.~E. Koditschek, ``Hierarchically clustered
  navigation of distinct euclidean particles,'' in \emph{Communication,
  Control, and Computing (Allerton), 2012 50th Annual Allerton Conference on},
  2012, pp. 946--953. [Online]. Available:
  \url{http://kodlab.seas.upenn.edu/Main/Allerton2012}
\BIBentrySTDinterwordspacing

\bibitem{ayanian_kumar_koditschek_RR2011}
N.~Ayanian, V.~Kumar, and D.~Koditschek, ``Synthesis of controllers to create,
  maintain, and reconfigure robot formations with communication constraints,''
  in \emph{Robotics Research}, ser. Springer Tracts in Advanced Robotics,
  C.~Pradalier, R.~Siegwart, and G.~Hirzinger, Eds.\hskip 1em plus 0.5em minus
  0.4em\relax Springer Berlin / Heidelberg, 2011, vol.~70, pp. 625--642.

\bibitem{billera_holmes_vogtmann_aap2001}
L.~J. Billera, S.~P. Holmes, and K.~Vogtmann, ``Geometry of the space of
  phylogenetic trees,'' \emph{Advances in Applied Mathematics}, vol.~27, no.~4,
  pp. 733 -- 767, 2001.

\bibitem{schrijver2003}
A.~Schrijver, \emph{Combinatorial optimization: polyhedra and
  efficiency}.\hskip 1em plus 0.5em minus 0.4em\relax Springer, 2003, vol.~24.

\bibitem{vogtmann_2007}
\BIBentryALTinterwordspacing
K.~Vogtmann, ``Geodesics in the space of trees.'' 2007, accessed May. 05, 2013.
  [Online]. Available:
  \url{www.math.cornell.edu/~vogtmann/papers/TreeGeodesicss/index.html}
\BIBentrySTDinterwordspacing

\bibitem{owen_provan_tcbb2011}
M.~Owen and J.~S. Provan, ``A fast algorithm for computing geodesic distances
  in tree space,'' \emph{Computational Biology and Bioinformatics, IEEE/ACM
  Transactions on}, vol.~8, no.~1, pp. 2 --13, jan.-feb. 2011.

\bibitem{carlsson_memoli_jmlr2010}
G.~Carlsson and F.~M\'{e}moli, ``{Characterization, Stability and Convergence
  of Hierarchical Clustering methods},'' \emph{Journal of Machine Learning
  Research}, vol.~11, pp. 1425--1470, 2010.

\bibitem{jain_dubes_1988}
A.~K. Jain and R.~C. Dubes, \emph{Algorithms for clustering data}.\hskip 1em
  plus 0.5em minus 0.4em\relax Prentice-Hall, Inc., 1988.

\bibitem{rammal_et_al_RMP1986}
R.~Rammal, G.~Toulouse, and M.~A. Virasoro, ``Ultrametricity for physicists,''
  \emph{Reviews of Modern Physics}, vol.~58, no.~3, p. 765, 1986.

\bibitem{sleator_tarjan_thurston_stoc1986}
D.~D. Sleator, R.~E. Tarjan, and W.~P. Thurston, ``Rotation distance,
  triangulations, and hyperbolic geometry,'' in \emph{Proceedings of the
  eighteenth annual ACM symposium on Theory of computing}, ser. STOC '86.\hskip
  1em plus 0.5em minus 0.4em\relax New York, NY, USA: ACM, 1986, pp. 122--135.

\bibitem{waterman_jtb1978}
M.~Waterman and T.~Smith, ``On the similarity of dendrograms,'' \emph{Journal
  of Theoretical Biology}, vol.~73, no.~4, pp. 789 -- 800, 1978.

\bibitem{feragenEtAl_IPMI2012}
A.~Feragen, M.~Owen, J.~Petersen, M.~Wille, L.~Thomsen, A.~Dirksen, and
  M.~Bruijne, ``Tree-space statistics and approximations for large-scale
  analysis of anatomical trees,'' in \emph{Information Processing in Medical
  Imaging}, ser. Lecture Notes in Computer Science.\hskip 1em plus 0.5em minus
  0.4em\relax Springer Berlin Heidelberg, 2013, vol. 7917, pp. 74--85.

\bibitem{chakerian_holmes_JCGS2012}
J.~Chakerian and S.~Holmes, ``Computational tools for evaluating phylogenetic
  and hierarchical clustering trees,'' \emph{Journal of Computational and
  Graphical Statistics}, vol.~21, no.~3, pp. 581--599, 2012.

\bibitem{khalil_2002}
H.~Khalil, \emph{Nonlinear systems, 3rd}.\hskip 1em plus 0.5em minus
  0.4em\relax New Jewsey, Prentice Hall, 2002.

\bibitem{semple_steel_2003}
C.~Semple and M.~Steel, \emph{Phylogenetics}.\hskip 1em plus 0.5em minus
  0.4em\relax Oxford University Press, 2003, vol.~24.

\end{thebibliography}
