Learn R Programming

FusedPCA (version 0.2)

laplacian: Laplacian matrix

Description

Get the Laplacian matrix of an observed graph. Both unnormalised and symmetric normalised Laplacian matrices are included.

Usage

laplacian(A, normalised = F)

Arguments

A
input matrix -- adjacency matrix of an observed graph, of dimension n-nodes x n-nodes.
normalised
whether the Laplacian matrix is normalised or not.

Value

if normalised = F, an unnormalised Laplacian matrix is returned, i.e. $L = D - A$; if normalised = T, a symmetric normalised Laplacian matrix is returned, i.e. $L = D^{-1/2}(D - A)D^{-1/2}$. $D$ is the degree diagonal matrix, with diagonal entries $d_i = \sum_{j = 1}^nA_{ij}$.

References

Yang Feng, Richard J. Samworth and Yi Yu, Community Detection via Fused Principal Component Analysis, manuscript.

Examples

Run this code
## to generate an adjacency matrix
A = matrix(c(0,1,1,1,0,0,1,0,0), byrow = TRUE, ncol = 3)

## have a look at A
A

## unnormalised Laplacian matrix
laplacian(A)

## normalised Laplacian matrix
laplacian(A, normalised = TRUE)

Run the code above in your browser using DataLab