Empirical_Degree_Distribution_ER <- function(n,lambda){ G<-sample_gnp(n,lambda/n) D<-degree_distribution(G) print(D[1:5]) print(dpois(0:4,lambda)) Max1<-max(abs(D-dpois(0:(length(D)-1),lambda))) NMax<-which.max(abs(D-dpois(0:(length(D)-1),lambda))) print(NMax) Max2<-max(dpois(length(D):max(length(D),ceiling(lambda)),lambda)) Max<-max(Max1,Max2) return(Max) } Empirical_Degree_Distribution_KM <- function(n,lambda){ D<-rpois(n,lambda) D[n]<-D[n]+(sum(D)%%2) G<-simplify(sample_degseq(D)) D<-degree_distribution(G) print(D[1:5]) print(dpois(0:4,lambda)) Max1<-max(abs(D-dpois(0:(length(D)-1),lambda))) NMax<-which.max(abs(D-dpois(0:(length(D)-1),lambda))) print(NMax) Max2<-max(dpois(length(D):max(length(D),ceiling(lambda)),lambda)) Max<-max(Max1,Max2) return(Max) } p_pa <- function(k,m,delta){ y<- (2+delta/m)*(k>=m)*gamma(k+delta)*gamma(m+2+delta+delta/m)/(gamma(m+delta)*gamma(k+3+delta+delta/m)) return(y) } Empirical_Degree_Distribution_PA <- function(n,edges,delta){ G<-sample_pa(n,power=1,m=edges,zero.appeal=1+delta) D<-degree_distribution(G) M<-100 for(i in min(length(D),M+1):(M+1)) { D[i]=0} print(D[1:5]) print(p_pa(0:4,edges,delta)) Max<-max(abs(D[1:(M+1)]-p_pa(0:M,edges,delta))) NMax<-which.max(abs(D[1:(M+1)]-p_pa(0:M,edges,delta))) print(NMax) return(Max) } Empirical_Degree_Distribution_RGG <- function(n,r){ lambda<-pi*n*r^2 G<-sample_grg(n,r) D<-degree_distribution(G) print(D[1:5]) print(dpois(0:4,lambda)) Max1<-max(abs(D-dpois(0:(length(D)-1),lambda))) NMax<-which.max(abs(D-dpois(0:(length(D)-1),lambda))) print(NMax) Max2<-max(dpois(length(D):max(length(D),ceiling(lambda)),lambda)) Max<-max(Max1,Max2) return(Max) }