% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_sam.R
\name{get_sam}
\alias{get_sam}
\title{Convert a multilayer class to a supra-adjacency matrix}
\usage{
get_sam(
  multilayer,
  bipartite,
  directed,
  sparse = FALSE,
  remove_zero_rows_cols = FALSE
)
}
\arguments{
\item{multilayer}{The multilayer object.}

\item{bipartite}{Is the network bipartite? Must be provided (no default
value).}

\item{directed}{Is the network directed? Must be provided (no default value).}

\item{sparse}{Should the returned matrix be a sparse matrix (class Matrix)?
Defaults to false.}

\item{remove_zero_rows_cols}{Should rows and columns that sum to 0 be
removed? Defaults to false.}
}
\value{
A list:
\itemize{
  \item \code{M} The SAM. Can also be sparse.
  \item \code{nodes} A table of physical nodes, as in the multlayer object.
  \item \code{state_nodes_map} A table with state nodes to map the nodes to the row and columns of the SAM.
}
}
\description{
This function creates a supra-adjacency matrix from a multilayer object.
}
\details{
By default, a SAM contains all the nodes in all the layers. However,
  not all nodes always occur in all layers. This will be reflected in the
  \code{state_nodes_map}: When layer and node ids are NA that means that the
  node did not occur in the layer.

  A node may not have links across all
  the layers. In that case, its row or column sum will be zero. This can happen in a
  directed matrix (see toy example for unipartite network), or in
  diagonally-coupled networks (see toy bipartite example). The user can choose to remove rows and columns that sum to zero by setting \code{remove_zero_rows_cols} to \code{TRUE}.
}
\examples{

# See examples in:
# https://emln.ecomplab.com/multilayer.html#To_supra-adjacency_matrices

}
