如果您从 R 中使用 igraph,请使用此选项
scg_semi_proj {igraph} | R 文档 |
一个计算给定顶点划分的 L
和 R
半投影算子的函数。
scg_semi_proj(
groups,
mtype = c("symmetric", "laplacian", "stochastic"),
p = NULL,
norm = c("row", "col"),
sparse = igraph_opt("sparsematrices")
)
groups |
一个长度为 |
mtype |
半投影算子的类型。目前,“symmetric”、“laplacian” 和 “stochastic” 可用。 |
p |
一个长度为 |
norm |
“row” 或 “col”。如果设置为 “row”,则拉普拉斯矩阵的行总和为零,而随机矩阵的行总和为 1;否则为列。 |
sparse |
逻辑标量,是否返回稀疏矩阵。 |
三种类型的半投影算子定义如下。设 \gamma(j)
标记所有顶点的划分中顶点 j
的组。
对称半投影算子定义为
L_{\alpha j}=R_{\alpha j}=
\frac{1}{\sqrt{|\alpha|}}\delta_{\alpha\gamma(j)},
(行) 拉普拉斯半投影算子定义为
L_{\alpha j}=\frac{1}{|\alpha|}\delta_{\alpha\gamma(j)}\,\,\,\,
\textrm{和}\,\,\,\, R_{\alpha j}=\delta_{\alpha\gamma(j)},
和 (行) 随机半投影算子定义为
L_{\alpha j}=\frac{p_{1}(j)}{\sum_{k\in\gamma(j)}p_{1}(k)}\,\,\,\,
\textrm{和}\,\,\,\, R_{\alpha j}=\delta_{\alpha\gamma(j)\delta_{\alpha\gamma(j)}},
其中 p_1
是与随机矩阵的特征值 1 相关的 (左) 特征向量。 当 norm = col
时,L
和 R
以对称方式定义。 所有这些半投影算子都验证了参考文献中描述的各种属性。
L |
半投影算子 |
R |
半投影算子 |
David Morton de Lachapelle, http://people.epfl.ch/david.morton.
D. Morton de Lachapelle, D. Gfeller, and P. De Los Rios, Shrinking Matrices while Preserving their Eigenpairs with Application to the Spectral Coarse Graining of Graphs. Submitted to SIAM Journal on Matrix Analysis and Applications, 2008. http://people.epfl.ch/david.morton
scg-method 获取详细介绍. scg
, scg_eps
, scg_group
library(Matrix)
# compute the semi-projectors and projector for the partition
# provided by a community detection method
g <- sample_pa(20, m = 1.5, directed = FALSE)
eb <- cluster_edge_betweenness(g)
memb <- membership(eb)
lr <- scg_semi_proj(memb)
#In the symmetric case L = R
tcrossprod(lr$R) # same as lr$R %*% t(lr$R)
P <- crossprod(lr$R) # same as t(lr$R) %*% lr$R
#P is an orthogonal projector
isSymmetric(P)
sum( (P %*% P-P)^2 )
## use L and R to coarse-grain the graph Laplacian
lr <- scg_semi_proj(memb, mtype="laplacian")
L <- laplacian_matrix(g)
Lt <- lr$L %*% L %*% t(lr$R)
## or better lr$L %*% tcrossprod(L,lr$R)
rowSums(Lt)