to_data_frame: Export Network as Edge List Data Frame

View source: R/network-utils.R

to_data_frameR Documentation

Export Network as Edge List Data Frame

Description

Converts a network to an edge list data frame with columns for source, target, and weight.

Usage

to_data_frame(x, directed = NULL)

to_df(x, directed = NULL)

Arguments

x

Network input: matrix, igraph, network, cograph_network, or tna object.

directed

Logical or NULL. If NULL (default), auto-detect from matrix symmetry. Set TRUE to force directed, FALSE to force undirected.

Value

A base data.frame with one row per edge and exactly three columns:

  • from: Source node name/label

  • to: Target node name/label

  • weight: Edge weight

Further edge columns, such as session or time from temporal edge lists, are dropped. get_edges returns the full edge table. An undirected network contributes one row per unordered pair.

See Also

to_df, to_igraph, as_cograph

Examples

to_data_frame(regulation_net)

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