我使用就绪功能度, 如何获得顶点(结果在顶部)
0 1 2 3 4 5 7 10 6 9 12 15 14 11
该函数返回结果,为进行分析,我还需要底部
> measure1<-degree(g1)
> measure1
0 1 2 3 4 5 7 10 6 9 12 15 14 11
3 5 1 3 2 1 4 3 2 3 1 2 1 1
g1 <-read.table(listcsv[k]) g1 <- graph.data.frame(g1,directed=FALSE)
0 1
0 6
0 9
1 6
1 7
1 12
1 15
2 7
3 4
3 10
3 14
4 9
5 9
7 10
7 11
10 15
答案 0 :(得分:0)
欢迎使用Stack Exchange,谢谢您的提问。但是,我建议您阅读有关minimal reproducible example的信息。得到答案的可能性更高。
关于您的问题,degree
程序包的igraph
函数返回一个命名的矢量,其中矢量值的名称是漩涡。请参见下面的示例:
library(igraph)
actors <- data.frame(name=c("Alice", "Bob", "Cecil", "David",
"Esmeralda"),
age=c(48,33,45,34,21),
gender=c("F","M","F","M","F"))
relations <- data.frame(from=c("Bob", "Cecil", "Cecil", "David",
"David", "Esmeralda"),
to=c("Alice", "Bob", "Alice", "Alice", "Bob", "Alice"),
same.dept=c(FALSE,FALSE,TRUE,FALSE,FALSE,TRUE),
friendship=c(4,5,5,2,1,1), advice=c(4,5,5,4,2,3))
g <- graph.data.frame(relations, directed=TRUE, vertices=actors)
r <- degree(g)
# extraction of degree(g) names (vortices)
d <- data.frame(degrees = degree(g), nms = names(r))
d
输出:
degrees nms
Alice 4 Alice
Bob 3 Bob
Cecil 2 Cecil
David 2 David
Esmeralda 1 Esmeralda