% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{plot_network}
\alias{plot_network}
\title{Plot the co-abundance network}
\usage{
plot_network(
  fancy_result,
  taxonomy,
  top_n = NULL,
  layout = "fruchterman.reingold",
  community = FALSE
)
}
\arguments{
\item{fancy_result}{An object of class \code{"fancy"} as returned by
\code{\link[=fancy]{fancy()}}.}

\item{taxonomy}{A data.frame with MAG IDs as row names and at least
\code{Phyla} and \code{Genus} columns.}

\item{top_n}{Integer or \code{NULL}; if set, only the top N edges by
\code{HybridScore} are plotted (default \code{NULL} = all thresholded edges).}

\item{layout}{Character; igraph layout algorithm name (default
\code{"fruchterman.reingold"}).}

\item{community}{Logical; if \code{TRUE}, run modularity-based community
detection and draw shaded convex hulls around clusters (default
\code{FALSE}).}
}
\value{
Invisibly returns the igraph graph object.
}
\description{
Draws a network graph from a \code{"fancy"} result using igraph. Nodes are
coloured by phylum (via \code{\link[=phyla_palette]{phyla_palette()}}) and labelled with genus names.
Edge width is proportional to \code{HybridScore}. When \code{community = TRUE},
modularity-based community detection is applied and clusters are shown
as shaded convex hulls around groups of co-abundant MAGs.
}
\examples{
\donttest{
data(fancy_tiny_clr)
data(fancy_tiny_taxonomy)
result <- fancy(t(fancy_tiny_clr), n_bootstrap = 2, cpus = 1)
plot_network(result, fancy_tiny_taxonomy)
}
}
