to_igraph: Convert Network to igraph Object

View source: R/network-utils.R

to_igraphR Documentation

Convert Network to 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.

Usage

to_igraph(x, directed = NULL)

Arguments

x

Network input. Can be:

  • A square numeric matrix (adjacency/weight matrix)

  • A data frame edge list with source and target columns

  • An igraph object (returned as-is or converted if directed differs)

  • A statnet network object

  • A cograph_network object

  • A tna object

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.

See Also

to_data_frame, as_cograph

Examples


to_igraph(regulation_net)


cograph documentation built on Nov. 19, 2026, 5:07 p.m.