简体   繁体   English

创建有向随机图来指定幂律度分布的alpha

[英]Create directed random graph specifing alpha of power-law degree distribution

I have a real directed graph for which I know the number of nodes and edges. 我有一个真正的有向图,对于该图我知道节点和边的数量。 The degree distribution approximates a power-law distribution. 度分布近似于幂律分布。 Now I want to create a random graph replicating the following features of my real graph: 现在,我想创建一个随机图来复制真实图的以下功能:

  • Number of nodes 节点数
  • Number of edges 边数
  • (Similar) power-law indegree and out distribution (类似)幂律的进出度分布

Let's assume g is my real graph of 10000 nodes and 30000 edges 假设g是我的10000个节点和30000个边的实图

exp.out = 2.2
exp.in = 2.3

set.seed(123)
g <- static.power.law.game(10000, 30000, exp.out, exp.in, multiple=TRUE)

Yet I don't know exp.out and exp.in . 但是我不知道exp.outexp.in Then I try to estimate the power-law exponents with the plfit function ( downloaded here ): 然后,我尝试使用plfit函数( 在此处下载 )估算幂律指数:

plfit(degree(g, mode="in")+1)

# $xmin
# [1] 5
# 
# $alpha
# [1] 2.97
# 
# $D
# [1] 0.01735342

plfit(degree(g, mode="out")+1)

# $xmin
# [1] 5
# 
# $alpha
# [1] 2.83
# 
# $D
# [1] 0.01589222

From which I then derive my distribution functions (respectively for indegree and outdegree): 然后从中得出分布函数(分别针对度数和度数):

  • p(x) ~ x^-2.97 for x >= 5 对于x> = 5 p(x)〜x ^ -2.97
  • p(x) ~ x^-2.83 for x >= 5 对于x> = 5 p(x)〜x ^ -2.83

According to the documentation of static.power.law.game 根据static.power.law.game文档

The game simply uses static.fitness.game with appropriately constructed fitness vectors. 该游戏仅使用带有适当构造的适应度向量的static.fitness.game。 In particular, the fitness of vertex i is i^(-alpha), where alpha = 1/(gamma-1) and gamma is the exponent given in the arguments 特别是,顶点i的适应度为i ^(-alpha),其中alpha = 1 /(gamma-1),且gamma是自变量中给出的指数

As far as I understand it, to replicate my alphas I should pass as gammas respectively 1.3367 (2.97=1/(x-1)) and 1.35336 (2.83=1/(x-1)). 据我了解,要复制我的Alpha,我应该分别以gamma传递1.3367(2.97 = 1 /(x-1))和1.35336(2.83 = 1 /(x-1))。 Then 然后

set.seed(321)
random.g <- static.power.law.game(10000, 30000, 1.35336, 1.3367, multiple=TRUE)
# Error in .Call("R_igraph_static_power_law_game", no.of.nodes, no.of.edges,  : 
#                  At games.c:3748 : out-degree exponent must be >= 2, Invalid value

Yet the fact that static.power.law.game only takes degree exponents higher then or equal to 2 makes me think that probably I am missing something... 然而, static.power.law.game只需要将指数取高到等于或等于2的事实,使我认为我可能错过了一些东西。

exp_out and exp_in should simply be the desired exponent of the out-degree and in-degree distributions, there is no need to do any transformations on the exponents you have obtained from plfit . exp_outexp_in应该只是出度和入度分布的期望指数,无需对您从plfit获得的指数进行任何转换。 However, note that it is unlikely that you will recover your "observed" exponents exactly due to finite size effects 但是,请注意,由于大小有限的影响,您不太可能完全恢复“观察到的”指数

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

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