center_graph: Center adjacency matrix

View source: R/center_graph.R

center_graphR Documentation

Center adjacency matrix

Description

Center the adjacency matrix by re-weighting edges according to a specified scheme

Usage

center_graph(A, scheme = c(-1, 1), use_splr = TRUE)

Arguments

A

A matrix, an igraph object. Adjacency matrix.

scheme

A character vector, number or pair of numbers. Default c(-1, 1). See Details.

use_splr

A boolean indicating whether to use the splrMatrix object when storing the centered graph. Defaults to TRUE.

Details

The options for scheme are

  • "naive" Returns original A

  • Integer: Returns A - A_{scheme} where A_{scheme} is the best rank-scheme approximation of A.

  • A pair of scalars: Returns s * A + a such that the minimum of the returned matrix is min(scheme) and the maximum is max(scheme).

  • "center": Same as scheme=c(-1,1)

Value

centered adjacency matrix as a splrMatrix if useSplr = TRUE, otherwise as a Matrix object.

Examples

A <- sample_correlated_gnp_pair(n = 10, corr = .5, p = .5)$graph1
center_graph(A, scheme = "naive")
center_graph(A, scheme = "center")
center_graph(A, scheme = 2)
center_graph(A, scheme = c(-4, 2))


dpmcsuss/iGraphMatch documentation built on Feb. 15, 2024, 3:26 p.m.