我想知道绘制度数分布的脚本输出是否正确。
所以脚本是(其中具有我所有顶点度数的向量存储在x中):
x 是
x
[1] 7 9 8 5 6 2 8 9 7 5 2 4 6 9 2 6 10 8
x 是某个网络顶点的度数 - 就像顶点 1 的度数为 7,顶点 2 的度数为 9,依此类推 x <- v2 summary(x)
library(igraph)
split.screen(c(1,2))
screen(1)
plot (tabulate(x), log = "xy", ylab = "Frequency (log scale)", xlab = "Degree (log scale)", main = "Log-log plot of degree distribution")
screen(2)
y <- (length(x) - rank(x, ties.method = "first"))/length(x)
plot(x, y, log = "xy", ylab = "Fraction with min. degree k (log scale)", xlab = "Degree (k) (log scale)", main = "Cumulative log-log plot of degree distribution")
close.screen(all = TRUE)
power.law.fit(x, xmin = 50)
我的问题是对数图似乎不正确 - 例如,我的度数为 8 次,所以对数图上的这一点不应该变成 0.845 (log 7)/0.903 (log( 8) 如 (x/y)?
此外,有人能告诉我如何将线(对数刻度上的幂律)拟合到屏幕 2 中的图吗?