虽然有一些关于从邻接矩阵创建图的问题,但我还没有找到很多关于从加权图中提取加权邻接矩阵的信息。
假设我有以下图表:
library(igraph)
nodes <- data.frame(name=c("a","b", "c", "d", "f", "g"))
col1 <- c("a", "g", "f","f", "d","c")
col2 <- c("b", "f","c","d","a","a")
weight <- c(1,4,2,6,2,3)
edges <- cbind.data.frame(col1,col2,weight)
g <- graph.data.frame(edges, directed=F, vertices=nodes)
E(g)$weight <- weight
如何获得图 g 的加权邻接矩阵?