Skip to contents

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)

Arguments

adj_matrix

Square adjacency matrix.

directed

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

Value

Data frame with columns:

  • from: Source node name

  • to: Target node name

  • weight: Edge weight (if not binary)