% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/list_to_matrix.R
\name{list_to_matrix}
\alias{list_to_matrix}
\title{Edge list to matrix conversion}
\usage{
list_to_matrix(
  x,
  directed = FALSE,
  bipartite = TRUE,
  group_names = c("set_cols", "set_rows"),
  node_metadata = NULL
)
}
\arguments{
\item{x}{An edge list of the format \code{from to weight}.}

\item{directed}{Is the network directed?}

\item{bipartite}{Is network bipartite?}

\item{group_names}{For bipartite networks: name of the groups in the columns
and rows, respectively (e.g., parasites and hosts).}

\item{node_metadata}{Following the igraph method of \code{graph_from_data_frame}.
Must have a column called node_name with names matching those in x.}
}
\value{
A \code{monolayer} object.
}
\description{
Convert an edge list to a matrix. Can handle unipartite and bipartite
networks.
}
\details{
It is also possible to add node attributes. For this, it uses
igraph. The first column in the \code{node_metadata} data frame should have
the names of the nodes in the edge list.
}
\examples{
library(dplyr)
network <- load_emln(17)
nodes <- network$nodes
links<-subset(network$extended_ids \%>\% filter(layer_from==1), select=c(node_from, node_to, weight))

list_to_matrix(links, directed = TRUE, bipartite = FALSE, node_metadata = nodes)


# See examples in:
# https://emln.ecomplab.com/monolayer.html#Unipartite

}
\seealso{
Functions \code{create_monolayer_network, monolayer} and \code{graph_from_data_frame} from igraph.
}
