Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
根据双模IGRAPHE图中第一个节点集的给定坐标调整第二个节点集的位置_R_Igraph_Bipartite - Fatal编程技术网

根据双模IGRAPHE图中第一个节点集的给定坐标调整第二个节点集的位置

根据双模IGRAPHE图中第一个节点集的给定坐标调整第二个节点集的位置,r,igraph,bipartite,R,Igraph,Bipartite,我想根据第一个节点集的给定坐标,调整第二个节点集的位置,以便使用IGRAPHE绘制双模图。有没有方便的方法 这里有一个可复制的示例,显示了我想要做的事情 library(igraph) set.seed(01) # get sample matrix bip <- matrix(sample(0:1,10*20, replace=TRUE),10,20) # transform to bipartite incidence matrix for plotting g <- gr

我想根据第一个节点集的给定坐标,调整第二个节点集的位置,以便使用IGRAPHE绘制双模图。有没有方便的方法

这里有一个可复制的示例,显示了我想要做的事情

library(igraph)

set.seed(01)

# get sample matrix
bip <- matrix(sample(0:1,10*20, replace=TRUE),10,20)

# transform to bipartite incidence matrix for plotting
g <- graph_from_incidence_matrix(bip)

# initialise empty matrix for coords of the first nodeset
layout_given <- matrix(0, 10, 2)
# sample some coordinates that represent those which are given 
layout_given[,1] <- sample(-2.435651:3.670977,10, replace = T)
layout_given[,2] <- sample(-2.435651:3.670977,10, replace = T)

# these are the standard positions of the nodes the algorithm 
# layout.fruchterman.reingold assigns
layout_fr = layout.fruchterman.reingold(g)

# replace the given positions with those generated by the algorithm. 
# these are the first 10 in the layout 30x2 layout matrix 
# (because there are 10 nodes of the first nodeset) with those that I would like 
# to hold fixed
layout_fr[1:10,] <- layout_given


plot(g, 
 layout = layout_fr,
 vertex.shape= c("circle", "square")[V(g)$type+1],
 vertex.color= c("red", "orange")[V(g)$type+1])
库(igraph)
种子集(01)
#获取样本矩阵

bip为什么不使用?好主意,但如果有可能解决这个难题,它将绝对很棒,特别是对于绘制具有一个地理参考节点集的双模网络,我的第一条评论中的链接将引导您找到用于计算R的igraph中的二分布局的文档。我建议您从这里开始。我不认为
布局是二分布局()
实际上很有帮助,因为我拥有的真实网络由大约30个第一种节点类型的节点和200多个第二种节点集组成,因此很难看到第一种节点类型的节点与第二种节点类型的节点连接。还有什么建议吗?此外,我在NE下绘制了第二种网络一种模式的网络ath,所以我想最好使用
fruchtermann.reingold
?然而,几乎无论是哪种布局,任何节点>50-100的随机或近似随机图都会看起来像一个毛球。二分布局算法试图最小化边交叉,从而最大限度地提高您能够看到co中差异的机会不同节点之间的活动性。但是,在2维中解开30*200+关系时,你能做的只有这么多。为什么不使用?好主意,但如果有可能解决这个难题,那绝对是件好事,尤其是在绘制带有一个地理参考节点集的两种模式网络时。我的第一条评论中的链接会将你引向文档计算R的igraph中的二分布局的方法。我建议您从这里开始。我不认为
layout\u是二分()
实际上很有帮助,因为我拥有的真实网络由大约30个第一种节点类型的节点和200多个第二种节点集组成,因此很难看到第一种节点类型的节点与第二种节点类型的节点连接。还有什么建议吗?此外,我在NE下绘制了第二种网络一种模式的网络ath,所以我想最好使用
fruchtermann.reingold
?然而,几乎无论是哪种布局,任何节点>50-100的随机或近似随机图都会看起来像一个毛球。二分布局算法试图最小化边交叉,从而最大限度地提高您能够看到co中差异的机会不同节点之间的连接。但在2维空间中解开30*200+关系时,你只能做这么多。