Graph Laplacian Matrices

Share:

Description

Functions for generating graph laplacian matrices based on nearest neighbors in a grid structure or neighbors a certain distance apart.

Usage

1
2

Arguments

dims

A vector containing the dimensions of the underlying grid. One, two and three-dimensional grids are supported.

matrix

A full distance matrix. This can be computed via any distance metric.

window

A scalar denoting the maximum distance at which points are considered neighbors, meaning they share an edge in the graph structure.

Details

Graph Laplacian matrices can be used as generalizing operators in the GPCA framework. These behave like inverse covariances and are useful for recovering edges in the GPCA factors. Laplacians are defined as the degree matrix minus the adjacency matrix for a network structure.

For variables structured as a grid, Laplacians are constructed by placing edges between neighbors in the grid structure. For one dimensional grids (e.g. equally-spaced time points), this is a chain graph. Nearest neighbors for two and three dimensional grids (e.g. image data) are defined using the Chebychev distance. Laplacians for grid structures are scaled to have operator norm one, which is required for use with gpca and sgpca.

Laplacians are constructed from a general distance matrix by placing edges between variables less than or equal to window distance apart. These are returned without scaling to have operator norm one, and must be appropriately scaled before used with gpca and sgpca.

Value

Q

A sparse matrix of the class dgCMatrix.

Author(s)

Frederick Campbell

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#Laplacians on a 1D, 2D, and 3D grid
Q = laplacian(10)
Q = laplacian(c(10,10))
Q = laplacian(c(10,10,10))

#Laplacians computed based on Euclidean distances
data(ozone2)
D = as.matrix(dist(ozone2$lon.lat))
Q = distLaplacian(D,2)
Q = Q/max(eigen(Q,only.values=TRUE)$values)