I would like to know whether the output of a script to plot a degree distribution can be correct.
So the script is ( where the vector with the degrees of all my vertices is stored in x):
x is
x
[1] 7 9 8 5 6 2 8 9 7 5 2 4 6 9 2 6 10 8
x is the degree of a certain network vertice - like vertice 1 has degree 7, vertice 2 has degree 9 and so on 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)
My problem is that the log-log plot seems to be incorrect - for instance, I have the degree '7' 8 times overall so shouldn't this point on a log-log plot become 0.845 (log 7)/ 0.903 (log(8) as in (x/y)?
Moreover, can somebody tell me how to fit the line ( the power-law on the log-log scale) to the plot in the screen 2 ?