% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compute_moments.R
\name{compute_network_moments}
\alias{compute_network_moments}
\title{Compute edge density and network moments}
\usage{
compute_network_moments(A, motif_specs)
}
\arguments{
\item{A}{A square binary adjacency matrix (\strong{dense}).  Must have at
least 3 rows/columns for V-shape and triangle moments, and at least 4 for
the 3-star moment.}

\item{motif_specs}{Compiled motif specification, as returned by
\code{\link{init_motif_specs}}.}
}
\value{
A list with:
\describe{
  \item{\code{rho}}{Scalar edge density.}
  \item{\code{UR}}{Named numeric vector of network moments (one per motif
    in \code{motif_specs}).}
}
Rows corresponding to graphs with zero density return \code{rho = 0} and
all moments equal to zero.
}
\description{
Given a square binary adjacency matrix and a compiled motif specification,
returns the edge density and the vector of network moments (rescaled motif
counts).
}
\details{
For a network with \eqn{k} nodes the edge density is
\eqn{\hat\rho = |E| / [k(k-1)]}.  The network moment for motif \eqn{R}
with \eqn{r} nodes is \eqn{U_R = \binom{k}{r}^{-1} X_R}, where \eqn{X_R}
is the (non-induced) motif count.  Built-in moments use matrix-algebraic
formulas that avoid explicit enumeration.
}
\keyword{internal}
