简体   繁体   English

同一图上的多度分布

[英]Multiple degree distribution on the same plot

I generated 500 random bipartite networks using the code below. 我使用以下代码生成了500个随机两方网络。 I would like to plot the degree distribution (log-log plots with power law line) of atleast 10 of these networks on a single plot to compare them with the log-log plot of my scale free network visually. 我想在单个图上绘制这些网络中至少10个网络的度分布(带有幂律线的对数-对数图),以可视方式将它们与我的无标度网络的对数-对数图进行比较。 I know how to plot the degree distribution of a single network at a time but multiple plots on the same graph is getting to be elusive. 我知道如何一次绘制单个网络的度分布,但是在同一张图上的多个图变得难以捉摸。 Also if possible, I could also use an excel sheet with the pearson correlation coefficient and the slope values of all 500 networks. 同样,如果可能的话,我还可以使用具有皮尔逊相关系数和所有500个网络的斜率值的Excel工作表。 .

set.seed(1)
    gs1 <- list()
    for (x in seq_len(500L)) 
    {
      gs1[[x]] <- sample_bipartite(358, 27, type = "gnm",m = 827, directed = TRUE)
    }

EDIT: I am looking for a power law line with the degree distribution. 编辑:我正在寻找具有度数分布的幂律线。

Any help is appreciated. 任何帮助表示赞赏。 Thank you to you all. 谢谢大家

I think that I am making the plot that you are looking for. 认为我正在制作您要寻找的情节。 If not please explain how it differs. 如果没有,请说明其不同之处。

You can plot the first distribution and then add to it using lines . 您可以绘制第一个分布,然后使用lines将其添加。 Because each distribution has a different number of degrees, I go through all of them once to find the upper limit. 由于每个分布具有不同的度数,因此我会遍历所有度数以找到上限。

library(igraph)

## Reproduce your data, paramterizing the number of graphs
NumG = 500L
set.seed(1)
gs1 <- list()
for (x in seq_len(NumG)) {
      gs1[[x]] <- sample_bipartite(358, 27, type = "gnm",m = 827, directed = TRUE)
}

## Find upper limit on degrees
MaxDeg = rep(0,NumG)
for(i in 1:NumG) {
    DD = degree_distribution(gs1[[i]])
    MaxDeg[i] = length(DD)
}
MaxMax = max(MaxDeg)

## Plot first distribution
plot(1:MaxDeg[1], degree_distribution(gs1[[1]]), 
    xlim=c(1,MaxMax), log="xy", type="l",
    xlab="Log-Degree", ylab="LogFrequency")

## Plot all the rest
for(i in 2:NumG) {
    lines(1:MaxDeg[i], degree_distribution(gs1[[i]]), col=rainbow(NumG)[i])
}

学位分布

You can see the two pieces for the two types of nodes. 您可以看到两种类型的节点的两部分。 Overall, these seem pretty consistent. 总体而言,这些似乎很一致。

Adding a little detail 添加一点细节

There are two different types of nodes. 有两种不同类型的节点。 From your generating statement 从您的生成语句

gs1[[x]] <- sample_bipartite(358, 27, type = "gnm",m = 827, directed = TRUE)

there are 358 nodes that only have links leaving them (Sources). 有358个节点只有链接离开它们(源)。 There are also 27 nodes that have no links leaving them (Sinks). 还有27个没有链接的节点(接收器)。 Here is a plot of the first graph on your list, gs1[ 1 ]. 这是列表中第一个图形gs1 [ 1 ]的图。

LO = layout_as_bipartite(gs1[[1]])
plot(gs1[[1]], layout=LO, vertex.size=8, 
    edge.arrow.size=0.3, vertex.label=NA)

图1

The sources are on top and the sinks are on the bottom. 源在顶部,水槽在底部。 The two types of nodes have quite distinct degree distributions. 两种类型的节点具有完全不同的度数分布。 By construction, all of your graphs have 827 links. 通过构造,您的所有图形都有827个链接。 These leave the 358 sources and go to the 27 sinks. 这些离开了358个源,并进入了27个接收器。 On average, each source will have 827/358 = 2.31 links. 平均而言,每个来源将具有827/358 = 2.31链接。 On average, the sinks will have 858/27 = 30.63 links. 平均而言,接收器将具有858/27 = 30.63个链接。 It is easy to see these two distinct distribution in the above degree distribution plot. 在上面的度数分布图中很容易看到这两个不同的分布。

It does not appear to me that the degree distributions follow a power law, neither with the sources and sinks together nor either one separately. 在我看来,度数分布并不遵循幂定律,既不将源和汇放在一起,也不将其单独收集。 I am not sure what correlation coefficients you want to compute. 我不确定要计算什么相关系数。 So I have no help for you on those topics. 因此,在这些主题上,我没有任何帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM