简体   繁体   中英

Plot power law fit to degree distribution in igraph

I created a directed graph in igraph,

ba_game_graph <- sample_pa(10000, power = 1, m = NULL, out.dist = NULL, out.seq = NULL,
  out.pref = FALSE, zero.appeal = 1, directed = TRUE,
  algorithm = c("psumtree"), start.graph = NULL)

This is four years after the fact, but I think this is probably what you want:

# plot the degree distribution on a log-log plot
plot(ba_game_deg_dist_tot,
     log = "xy",
     xlab = "Node Degree",
     ylab = "Probability")

# add the fitted power law line; the exponent value comes from alpha, part of
# the output of the fit.power.law() function. 
lines(seq(ba_game_deg_dist_tot), 
      seq(ba_game_deg_dist_tot)^-ba_game_plaw$alpha, 
      col="#b00606")

Created on 2022-01-29 by the reprex package (v2.0.0)

Given the p-value (in the list produced by the power.law.fit() function), the model is a plausible fit to the data. But, if I understand things correctly, you'd need to confirm this by comparing the fit to other kinds of distributions which might be a better fit. Not sure how to do this--but maybe this gets you a bit closer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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