我有一个对称矩阵,表示演员之间的联系程度。我想取消未连接的顶点。
igraph 中包含的函数(如 delete_edges 或 delete_vertices)不适用于我的情况。我分享我的代码
#import of matrix
matrix3<-import("matrix2a.xlsx")
r.name <- matrix2a [,1]
rownames(matrix2a) <- r.name
matrix2a <- matrix2a %>% select(-X__1)
View(matrix2a)
m=as.matrix(matrix2a)
#I compute the maximum spanning tree graph
g <- graph_from_adjacency_matrix(m, mode = "upper", weighted = T, diag = F)
max_spann_tree <- mst(g, weights = -E(g)$weight)
#I obtain a network with some unconneted vertex that I would like to erase
在此先感谢您的帮助!