Rev. | cd7db6c18457c947e37699be4c22b19d01b854a2 |
---|---|
大小 | 1,541 字节 |
时间 | 2017-09-13 05:42:07 |
作者 | Lorenzo Isella |
Log Message | A file to split the generations of large clusters and provide a
|
rm(list=ls())
library(igraph)
library(ggplot2)
library(viridis)
library(scales)
library(grid)
library(ggthemes)
library(viridis)
library(tikzDevice)
library(magrittr)
library(dplyr)
source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R")
sort_frame <- function(df){
for (i in seq(nrow(df))){
df[i, ] <- sort(df,i, decreasing=T)
}
return(df)
}
golden_ratio <- 1.618
height <- 5
width <- height*golden_ratio
threshold <- 2.007
n_minus_1_norm <- 0
generations <- c(8,9,10,11)
gen_numbers <- c(8,4,2,1)
g_list <- list()
res <- c()
for (i in generations){
for (j in seq(gen_numbers[generations==i])){
fname <- paste("aggregate_number_",j,"_generation_",i,"_.dat", sep="")
print("fname is, ")
print(fname)
g <- get_aggregate(fname,threshold)
small_frag <- remove_link_stat_small(g)
temp <-cbind(small_frag, rep(vcount(g),length(small_frag)))
res <- rbind(res, temp)
}
}
if (n_minus_1_norm==1){
ress <- as.data.frame(res) %>% set_colnames(c("i_small", "n")) %>% mutate(i=.$n-.$i_small) %>% mutate(i_scaled=.$i/(.$n-1)) %>% mutate(i_small_scaled=.$i_small/(.$n-1)) %>% {.=.[, c("n", "i", "i_small","i_scaled", "i_small_scaled" )]}
} else {
ress <- as.data.frame(res) %>% set_colnames(c("i_small", "n")) %>% mutate(i=.$n-.$i_small) %>% mutate(i_scaled=.$i/(.$n)) %>% mutate(i_small_scaled=.$i_small/(.$n)) %>% {.=.[, c("n", "i", "i_small","i_scaled", "i_small_scaled" )]}
}
save_csv(ress, "large_fragments.csv")
saveRDS(ress, "large_fragments.RDS")
print("So far so good")