Learn R Programming

SVG (version 1.0.0)

adj_to_edgelist: Convert Adjacency Matrix to Edge List

Description

Converts a spatial adjacency matrix to an edge list data frame. Useful for integration with graph-based methods.

Usage

adj_to_edgelist(adj_matrix, directed = FALSE)

Value

Data frame with columns:

  • from: Source node name

  • to: Target node name

  • weight: Edge weight (if not binary)

Arguments

adj_matrix

Square adjacency matrix.

directed

Logical. If FALSE (default), only return unique undirected edges.