提问人:user3819396 提问时间:4/6/2023 更新时间:4/6/2023 访问量:20
PHP中是否有相等的R语言GDINA函数?
is there any equal R language GDINA function in PHP?
问:
我需要在 php 中使用 CDM GDINA 方法计算一些值。我已经尝试用 R 编程语言学习库 GDINA,但我发现我很难理解,因为我从不学习统计学,这对我来说非常复杂。PHP中是否有相等的R语言GDINA函数?
先谢谢你。
答:
0赞
protune222
4/6/2023
#1
# Find pairs of nodes with two shared neighbors
B <- A %*% A
pairs_two <- which(B == 2, arr.ind=TRUE)
cat("Pairs with two shared neighbors:\n")
cat(paste(paste(pairs_two[,1], pairs_two[,2], sep=" - "), collapse="\n"))
cat("\n")
# Find pairs of nodes with three shared neighbors
pairs_three <- which(B == 3, arr.ind=TRUE)
cat("Pairs with three shared neighbors:\n")
cat(paste(paste(pairs_three[,1], pairs_three[,2], sep=" - "), collapse="\n"))
cat("\n")
# Compute Laplacian matrix
D <- diag(rowSums(A))
L <- D - A
# Check for isolated vertices
isolated <- sum(diag(D) == 0) > 0
cat("Isolated vertices present: ")
cat(ifelse(isolated, "TRUE", "FALSE"))
评论