% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout_tree.R, R/layouts.R
\name{layout_tree_unrooted}
\alias{layout_tree_unrooted}
\alias{layout_as_tree_unrooted}
\alias{layout_igraph_tree_unrooted}
\title{unrooted tree layout}
\usage{
layout_as_tree_unrooted(
  g,
  mode = c("equalangle", "equaldaylight", "stress"),
  weights = NA,
  daylight_iter = 15,
  iter = 500,
  tol = 1e-04,
  bbox = 30
)

layout_igraph_tree_unrooted(
  g,
  mode = c("equalangle", "equaldaylight", "stress"),
  weights = NA,
  daylight_iter = 15,
  iter = 500,
  tol = 1e-04,
  bbox = 30,
  circular
)
}
\arguments{
\item{g}{igraph object. Each connected component must be a tree (acyclic).}

\item{mode}{which algorithm to use. One of \code{"equalangle"} (default),
\code{"equaldaylight"} or \code{"stress"}. See details.}

\item{weights}{possibly a numeric vector with edge weights, interpreted as
branch lengths. If this is NULL and the graph has a weight edge attribute,
then the attribute is used. If this is NA then unit branch lengths are used
(even if the graph has a weight attribute). By default, unit branch lengths
are used.}

\item{daylight_iter}{number of refinement sweeps for \code{mode = "equaldaylight"}.}

\item{iter}{number of iterations during stress optimization (only used for
\code{mode = "stress"}).}

\item{tol}{stopping criterion for stress optimization (only used for
\code{mode = "stress"}).}

\item{bbox}{width of layout. Only relevant to determine the placement of
disconnected components (forests).}

\item{circular}{not used}
}
\value{
matrix of xy coordinates
}
\description{
arranges the nodes of a tree (or forest) in the plane without a
designated root, using algorithms developed for drawing phylogenies.
}
\details{
Three algorithms are available:
\itemize{
\item \code{"equalangle"} (Felsenstein, 1989): each subtree is allotted an angular
wedge proportional to its number of leaves. Linear time, but can look
crowded on unbalanced trees.
\item \code{"equaldaylight"} (Felsenstein): iteratively equalizes the angular gaps
("daylight") around each internal node, starting from the equal-angle
layout, for a more balanced drawing.
\item \code{"stress"}: stress majorization using the patristic (tree path-length)
distances as target distances, reusing the package's stress engine.
}

Branch lengths (edge weights) are respected when present; otherwise unit
lengths are used.

The layout_igraph_* function should not be used directly. It is only used as
an argument for plotting with 'igraph'. 'ggraph' natively supports the layout.
}
\examples{
library(igraph)
g <- make_tree(20, 3, mode = "undirected")

xy <- layout_as_tree_unrooted(g)
xy <- layout_as_tree_unrooted(g, mode = "equaldaylight")
}
\references{
Felsenstein, J. (1989). PHYLIP - Phylogeny Inference Package
(Version 3.2). \emph{Cladistics}, 5, 164-166.

Bachmaier, C., Brandes, U., & Schlieper, B. (2005). Drawing phylogenetic
trees. \emph{In International Symposium on Algorithms and Computation} (pp.
1110-1121). Springer, Berlin, Heidelberg.
}
