normalize_adjacency: Normalize Adjacency Matrix

View source: R/spatial_weights.R

normalize_adjacencyR Documentation

Normalize Adjacency Matrix

Description

This function normalizes an adjacency matrix by dividing each element by the product of the square root of the corresponding row and column sums. Optionally, it can also symmetrize the normalized matrix by averaging it with its transpose.

Usage

normalize_adjacency(sm, symmetric = TRUE)

Arguments

sm

A sparse adjacency matrix representing the graph.

symmetric

A logical value indicating whether to symmetrize the matrix after normalization (default: TRUE).

Value

A normalized and, if requested, symmetrized adjacency matrix.

Examples

A <- matrix(runif(100), 10, 10)
A_normalized <- normalize_adjacency(A)


bbuchsbaum/neighborweights documentation built on April 1, 2024, 8:41 p.m.