File: laplacian_matrix.Rd

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (58 lines) | stat: -rw-r--r-- 1,979 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{laplacian_matrix}
\alias{graph.laplacian}
\alias{laplacian_matrix}
\title{Graph Laplacian}
\usage{
laplacian_matrix(graph, normalized = FALSE, weights = NULL,
  sparse = igraph_opt("sparsematrices"))
}
\arguments{
\item{graph}{The input graph.}

\item{normalized}{Whether to calculate the normalized Laplacian. See
definitions below.}

\item{weights}{An optional vector giving edge weights for weighted Laplacian
matrix. If this is \code{NULL} and the graph has an edge attribute called
\code{weight}, then it will be used automatically. Set this to \code{NA} if
you want the unweighted Laplacian on a graph that has a \code{weight} edge
attribute.}

\item{sparse}{Logical scalar, whether to return the result as a sparse
matrix. The \code{Matrix} package is required for sparse matrices.}
}
\value{
A numeric matrix.
}
\description{
The Laplacian of a graph.
}
\details{
The Laplacian Matrix of a graph is a symmetric matrix having the same number
of rows and columns as the number of vertices in the graph and element (i,j)
is d[i], the degree of vertex i if if i==j, -1 if i!=j and there is an edge
between vertices i and j and 0 otherwise.

A normalized version of the Laplacian Matrix is similar: element (i,j) is 1
if i==j, -1/sqrt(d[i] d[j]) if i!=j and there is an edge between vertices i
and j and 0 otherwise.

The weighted version of the Laplacian simply works with the weighted degree
instead of the plain degree. I.e. (i,j) is d[i], the weighted degree of
vertex i if if i==j, -w if i!=j and there is an edge between vertices i and
j with weight w, and 0 otherwise. The weighted degree of a vertex is the sum
of the weights of its adjacent edges.
}
\examples{
g <- make_ring(10)
laplacian_matrix(g)
laplacian_matrix(g, norm=TRUE)
laplacian_matrix(g, norm=TRUE, sparse=FALSE)
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\keyword{graphs}