Skip to contents

Parallel edges accumulate; a loop contributes to the degree but not to the diagonal of L (the d_v - w(v, v) term). Vertex labels are one-based.

Usage

Wgtlap(edges, n = NULL)

Arguments

edges

Matrix with rows (u, v, weight); u, v one-based.

n

Number of vertices (default: the largest label seen).

Value

List with W, L, degree, volume, n, m.

Details

Formula: w(u, v) = sum of the weights on {u, v}; L(u, v) = d_v - w(v, v) if u = v, -w(u, v) otherwise

References

Chung (1997), Spectral Graph Theory, CBMS 92, Section 1.4, for the weighted definition with loops.

Examples

M <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2)
Wgtlap(M)
#> $W
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    0    5    0
#> [2,]    0    0    0    6
#> [3,]    5    0    0    0
#> [4,]    0    6    0    0
#> 
#> $L
#>      [,1] [,2] [,3] [,4]
#> [1,]    5    0   -5    0
#> [2,]    0    6    0   -6
#> [3,]   -5    0    5    0
#> [4,]    0   -6    0    6
#> 
#> $degree
#> [1] 5 6 5 6
#> 
#> $volume
#> [1] 22
#> 
#> $n
#> [1] 4
#> 
#> $m
#> [1] 2
#> 
#> $method
#> [1] "Weighted Laplacian from an edge list"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"