to_matrix: Convert Network to Adjacency Matrix

View source: R/network-utils.R

to_matrixR Documentation

Convert Network to Adjacency Matrix

Description

Converts any supported network format to an adjacency matrix.

Usage

to_matrix(x, directed = NULL)

Arguments

x

Network input: matrix, cograph_network, igraph, network, tna, etc.

directed

Logical or NULL. If NULL (default), auto-detect from input.

Value

A square numeric adjacency matrix, preserving row/column names when available.

See Also

to_igraph, to_df, as_cograph, to_network

Examples

to_matrix(student_interactions)

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