% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/transfer_consensus.R
\name{TransferConsensus}
\alias{TransferConsensus}
\title{Consensus tree minimizing transfer distance}
\usage{
TransferConsensus(
  trees,
  scale = TRUE,
  greedy = c("best", "first"),
  init = c("empty", "majority")
)
}
\arguments{
\item{trees}{An object of class \code{multiPhylo}: the input trees.
All trees must share the same tip labels.}

\item{scale}{Logical; if \code{TRUE} (default), use the scaled transfer
distance (normalized by light-side size minus one).  If \code{FALSE}, use
the unscaled (raw Hamming) transfer distance.}

\item{greedy}{Character string specifying the greedy strategy:
\code{"best"} (default) picks the single highest-benefit action at each step;
\code{"first"} picks the first improving action encountered (faster but
potentially lower quality).}

\item{init}{Character string specifying the initial consensus:
\code{"empty"} (default) starts with no splits (purely additive);
\code{"majority"} starts with the majority-rule consensus and refines.}
}
\value{
A tree of class \code{phylo}.
}
\description{
Construct a consensus tree that minimizes the sum of transfer distances
to a set of input trees, using a greedy add-and-prune heuristic.
}
\details{
Unlike the majority-rule consensus, which minimizes Robinson-Foulds
distance and can be highly unresolved when phylogenetic signal is low,
\code{TransferConsensus()} uses the finer-grained transfer distance
\insertCite{Lemoine2018}{TreeDist} to construct a more resolved consensus
tree.

The algorithm pools all splits observed across input trees, computes
pairwise transfer distances between them, and greedily adds or removes
splits to minimize total transfer dissimilarity cost.  The approach
follows \insertCite{Takazawa2026;textual}{TreeDist}, reimplemented for
'TreeDist' infrastructure.
}
\examples{
library(TreeTools)
trees <- as.phylo(50:69, nTip = 12)

tc <- TransferConsensus(trees)
mr <- UnrootTree(Consensus(trees, p = 0.5)) # As root position is arbitrary
\dontshow{oPar <- par(mfrow = c(1, 2), mar = c(0.4, 0.4, 2, 0.4)) # Set up plotting area}
plot(tc, main = "Transfer consensus")
plot(mr, main = "Majority rule", direction = "left")
# Compare resolution
cat("Majority-rule splits:", NSplits(mr), "\n")
cat("Transfer consensus splits:", NSplits(tc), "\n")
\dontshow{par(oPar) # Restore plotting defaults}
}
\references{
\insertAllCited{}
}
\seealso{
Other summary trees:
\code{\link[=MCITree]{MCITree()}}
}
\concept{summary trees}
