% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/network-utils.R
\name{to_igraph}
\alias{to_igraph}
\title{Convert Network to igraph Object}
\usage{
to_igraph(x, directed = NULL)
}
\arguments{
\item{x}{Network input. Can be:
\itemize{
\item A square numeric matrix (adjacency/weight matrix)
\item A data frame edge list with source and target columns
\item An igraph object (returned as-is or converted if directed differs)
\item A statnet network object
\item A cograph_network object
\item A tna object
}}

\item{directed}{Logical or NULL. If NULL (default), auto-detect from matrix
symmetry. Set TRUE to force directed, FALSE to force undirected.}
}
\value{
An igraph object.
}
\description{
Converts various network representations to an igraph object. Supports
matrices, edge-list data frames, igraph objects, network objects,
cograph_network, and tna objects.
}
\examples{
# From matrix
adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3)
rownames(adj) <- colnames(adj) <- c("A", "B", "C")
g <- to_igraph(adj)

# Force directed
g_dir <- to_igraph(adj, directed = TRUE)
}
\seealso{
\code{\link{to_data_frame}}, \code{\link{as_cograph}}
}
