• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision6a3311f5ffd9127cc7d6df3975e921cb753ea6c0 (tree)
Zeit2020-11-17 21:25:12
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I now use the furrr library to speed up the computations.

Ändern Zusammenfassung

Diff

diff -r 1551d45aacc1 -r 6a3311f5ffd9 R-codes/cluster_frag_stat.R
--- a/R-codes/cluster_frag_stat.R Mon Nov 16 15:35:56 2020 +0100
+++ b/R-codes/cluster_frag_stat.R Tue Nov 17 13:25:12 2020 +0100
@@ -3,7 +3,7 @@
33 library(tidyverse)
44 library(igraph)
55 library(viridis)
6-
6+library(furrr)
77
88 source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R")
99
@@ -15,38 +15,46 @@
1515
1616 golden_ratio <- golden()
1717
18-generate_data <- 0
18+generate_data <- 1
1919
2020 cutoff <- 2.001
2121
22+n_cores <- 10
23+
2224 k_min <- 3
2325
2426 kf_val <- 1.3
25-df_val <- 1.8
27+df_val <- 1.6
28+
29+
30+
31+plan(multicore(workers=return_cores(n_cores)))
32+
33+
2634
2735 if (generate_data==1) {
2836
29-file_path <- "/home/lorenzo/MEGA/work/aggregates/big-cluster/"
37+file_path <- "./"
3038
3139
3240
3341 dat_files2 <- extract_file_list(file_path,".dat", full_path=1)
3442
3543
36-graph_list <- map2(dat_files2,cutoff, function(x,y) get_network_from_table(x,y))
44+graph_list <- future_map2(dat_files2,cutoff, function(x,y) get_network_from_table(x,y))
3745
3846 print("I have the networks")
3947
4048 saveRDS(graph_list, "graph_list.RDS")
4149
4250
43-frag_dist <- map(graph_list, fragment_cluster)
51+frag_dist <- future_map(graph_list, fragment_cluster)
4452
4553 print("I finished the fragmentation")
4654
4755 saveRDS(frag_dist, "frag_dist.RDS")
4856
49-branch_size_dist <- map2(graph_list,k_min, function(x,y) remove_nodes_high_deg(x,y) )
57+branch_size_dist <- future_map2(graph_list,k_min, function(x,y) remove_nodes_high_deg(x,y) )
5058
5159 print("I have the branch distribution")
5260
@@ -58,17 +66,17 @@
5866 ## tv <- map2(graph_list,3, ~ remove_nodes_high_deg(.x,.y) )
5967
6068
61-small_frag_exp <- map(frag_dist, function(x) mean(x$n2)) %>% flatten_dbl
69+small_frag_exp <- future_map(frag_dist, function(x) mean(x$n2)) %>% flatten_dbl
6270
6371 saveRDS(small_frag_exp,"small_fragment_distribution.RDS")
6472
6573 ## ## or using the tilde notation
6674 ## tt <- map(frag_dist, ~ mean(.x$n2)) %>% flatten_dbl
6775
68-number_mon <- map(graph_list, vcount) %>% flatten_int
76+number_mon <- future_map(graph_list, vcount) %>% flatten_int
6977 saveRDS(number_mon, "aggregate_sizes.RDS")
7078
71-diam_list <- map(graph_list, diameter) %>% flatten_dbl
79+diam_list <- future_map(graph_list, diameter) %>% flatten_dbl
7280
7381 saveRDS(diam_list, "diameters_list.RDS")
7482