% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmf.ffb.R, R/nmf.sem.R
\name{nmf.ffb.DOT}
\alias{nmf.ffb.DOT}
\alias{nmf.sem.DOT}
\title{Generate a Graphviz DOT Diagram for an NMF-FFB Model}
\usage{
nmf.ffb.DOT(result, ...)

nmf.sem.DOT(
  result,
  weight_scale = 5,
  weight_scale_c2 = weight_scale,
  weight_scale_x1 = weight_scale,
  weight_scale_feedback = weight_scale,
  threshold = 0.01,
  sig.level = 0.1,
  rankdir = "LR",
  fill = TRUE,
  cluster.box = c("normal", "faint", "invisible", "none"),
  cluster.labels = NULL,
  hide.isolated = TRUE,
  ...
)
}
\arguments{
\item{result}{A list returned by \code{nmf.sem}, containing matrices
\code{X}, \code{C1}, and \code{C2}.}

\item{...}{For backward compatibility: accepts deprecated names
\code{weight_scale_y2f} (use \code{weight_scale_c2}) and
\code{weight_scale_fy1} (use \code{weight_scale_x1}).}

\item{weight_scale}{Base scaling factor for edge widths.}

\item{weight_scale_c2}{Scaling factor for edges
\eqn{Y_2 \rightarrow F_q} (C2 matrix). Defaults to \code{weight_scale}.}

\item{weight_scale_x1}{Scaling factor for edges
\eqn{F_q \rightarrow Y_1} (X matrix). Defaults to \code{weight_scale}.}

\item{weight_scale_feedback}{Scaling factor for feedback edges
\eqn{Y_1 \rightarrow F_q} (C1 matrix). Defaults to \code{weight_scale}.}

\item{threshold}{Minimum coefficient value needed for an edge to be drawn.}

\item{sig.level}{Significance level for filtering structural edges
(\eqn{C_1} feedback and \eqn{C_2} exogenous loadings) when
inference results are present.  If \code{result} contains a
\code{coefficients} data frame from \code{\link{nmf.sem.inference}},
only edges with \code{p_value < sig.level} are drawn, with
significance stars (\code{*} \code{**} \code{***}) appended to
the edge label.  The \eqn{X} (factor-to-\eqn{Y_1}) edges are
never starred since the basis is not the inference target.
Set to \code{NULL} to disable significance filtering and fall
back to the \code{threshold} magnitude filter for both \eqn{C_1}
and \eqn{C_2}.  Default is \code{0.1}.}

\item{rankdir}{Graphviz rank direction (e.g., \code{"LR"}, \code{"TB"}).}

\item{fill}{Logical; whether to use filled node shapes.}

\item{cluster.box}{Character string controlling the visibility and style
of cluster frames around Y2, factors, and Y1 blocks.
One of \code{"normal"}, \code{"faint"}, \code{"invisible"}, \code{"none"}.}

\item{cluster.labels}{Optional character vector of length 3 giving custom
labels for the Y2, factor, and Y1 clusters.}

\item{hide.isolated}{Logical. If \code{TRUE} (default), Y1 and Y2 nodes
that have no edges at or above \code{threshold} are excluded from the graph.}
}
\value{
A character string representing a valid Graphviz DOT script.
}
\description{
Creates a Graphviz DOT script that visualizes the structural network
estimated by \code{nmf.sem}.
The resulting diagram displays:
\itemize{
\item endogenous observed variables (\eqn{Y_1}),
\item exogenous observed variables (\eqn{Y_2}),
\item latent factors (\eqn{F_1}, \dots, \eqn{F_Q}),
}
together with the non-negative path coefficients whose magnitudes
exceed a user-specified threshold.

Directed edges represent estimated relationships:
\itemize{
\item \eqn{Y_2 \rightarrow F_q}: entries of \code{C2} (exogenous loadings),
\item \eqn{F_q \rightarrow Y_1}: rows of \code{X} (factor-to-endogenous mappings),
\item \eqn{Y_1 \rightarrow F_q}: entries of \code{C1} (feedback paths).
}

Edge widths are scaled by coefficient magnitude, and nodes are placed
in optional visual clusters. Only variables participating in
edges above the threshold are displayed, while latent factors are always shown.
}
\examples{
Y <- t(iris[, -5])
Y1 <- Y[1:2, ]
Y2 <- Y[3:4, ]
result <- nmf.sem(Y1, Y2, rank = 2, maxit = 500)
dot <- nmf.sem.DOT(result)
cat(dot)

}
\seealso{
\code{\link{nmf.sem}}, \code{\link{nmf.sem.inference}},
\code{\link{plot.nmfkc.DOT}}
}
