【发布时间】:2013-02-28 08:28:01
【问题描述】:
我有一个双模网络的边缘列表,类似于:
person Event
Amy football_game
Sam picnic
Bob art_show
我想在 R 中对此进行分析,但似乎我尝试的一切都失败了。将其转换为单模式网络会遇到内存限制,我无法弄清楚如何在 igraph 或 tnet 中将其分析为二分。
在 igraph 中,bipartite.projection 给了我所有 FALSE,在使用
net <- graph.edgelist(myobject)
在 tnet 上,我无法将 igraph 网络转换为 tnet 网络,当我尝试使用原始数据帧时,由于图中重复而拒绝。
因此,我们将非常感谢您对以下任何问题的回答:
- 如何使用
bipartite.mapping函数? - 如何将 igraph 对象输入到 tnet?
- 如果一切都失败了,我该如何将具有重复边的数据框输入到 tnet 中?
很抱歉,如果这些是基本问题,但文档很少。
编辑
例子:
edgelist <- read.table(text="Person Event
Amy football
Bob picnic
Sam artshow",
header=TRUE)
edgelist <- as.matrix(edgelist)
## Igraph Issues
igraph <- graph.edgelist(edgelist)
typevector <- bipartite.projection(igraph)
# gets all FALSE
edgelist2 <- get.edgelist(igraph)
typevector <- bipartite.projection(edgelist2)
# same thing
## tnet issues
tnet <- as.tnet(edgelist)
# gives error: "There are duplicate events in the edgelist"
tnet <- as.tnet(edgelist2)
clusterMat <- clustering_local_tm(tnet)
# gives error: "max not meaningful for factors"
onemode <- projecting_tm(tnet, method="Newman")
# gives error: "arguments must have same length"
【问题讨论】:
-
总是尝试发布reproducible example。这将有很大帮助。我们不知道
myobject是什么。 -
另外,如果有人只有教程或 tnet 示例,那么仅此一项就会有很大帮助。
-
@user1888451 Tore Opsahl(作者)在他的网站上研究了一些例子。 toreopsahl.com/tnet