r - Create directed random graph specifing alpha of power-law degree distribution -
i have real directed graph know number of nodes , edges. grade distribution approximates power-law distribution. want create random graph replicating next features of real graph:
number of nodes number of edges (similar) power-law indegree , out distributionlet's assume g
real graph of 10000 nodes , 30000 edges
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 don't know exp.out
, exp.in
. seek estimate power-law exponents plfit
function (downloaded here):
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 derive distribution functions (respectively indegree , outdegree):
p(x) ~ x^-2.97 x >= 5 p(x) ~ x^-2.83 x >= 5according documentation of static.power.law.game
the game uses static.fitness.game appropriately constructed fitness vectors. in particular, fitness of vertex i^(-alpha), alpha = 1/(gamma-1) , gamma exponent given in arguments
as far understand it, replicate alphas should pass gammas respectively 1.3367 (2.97=1/(x-1)) , 1.35336 (2.83=1/(x-1)).
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, : # @ games.c:3748 : out-degree exponent must >= 2, invalid value
yet fact static.power.law.game
takes grade exponents higher or equal 2 makes me think missing something...
exp_out
, exp_in
should desired exponent of out-degree , in-degree distributions, there no need transformations on exponents have obtained plfit
. however, note unlikely recover "observed" exponents due finite size effects
r igraph
No comments:
Post a Comment