% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{cgv_layout_fr_bh}
\alias{cgv_layout_fr_bh}
\title{Barnes-Hut Fruchterman-Reingold Layout (3D, fast)}
\usage{
cgv_layout_fr_bh(
  n_nodes,
  edges,
  n_iter = 200L,
  ideal_len = NULL,
  theta = 1,
  cool = 0.98,
  min_dist = 0.01,
  seed = NULL,
  init = NULL,
  normalize = TRUE
)
}
\arguments{
\item{n_nodes}{Integer. Number of nodes.}

\item{edges}{Two-column integer matrix \code{(from, to)}, 1-based.}

\item{n_iter}{Integer. Number of iterations (default 200).}

\item{ideal_len}{Numeric target edge length. If \code{NULL},
defaults to \code{n_nodes^(1/3) * 0.8}.}

\item{theta}{Barnes-Hut opening angle (default 1.0). Larger = faster, less accurate.}

\item{cool}{Per-iteration temperature decay (default 0.98).}

\item{min_dist}{Minimum distance clamp for repulsion / edge attraction
(default 0.01). Avoids division-by-zero when nodes coincide.}

\item{seed}{Optional integer for reproducible initialization.}

\item{init}{Optional \code{n_nodes x 3} matrix of initial positions.
If \code{NULL}, uses \code{rnorm}.}

\item{normalize}{Logical. If \code{TRUE}, recenters and scales output to
\code{[-15, 15]}. Default \code{TRUE}.}
}
\value{
Numeric matrix \code{n_nodes x 3} of node coordinates.
}
\description{
Same energy model as \code{cgv_layout_fr} but with O(n log n) repulsion
approximated through an octree. Suitable for large graphs (10^4+ nodes).
}
