Skip to content

Commit

Permalink
resolves #23
Browse files Browse the repository at this point in the history
  • Loading branch information
lentendu committed Nov 29, 2024
1 parent fb583c8 commit 6a609da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rscripts/rand_network.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ cor_rand_r<-c(as.dist(cor_rand$r))
rand_cc<-laply(seq(pos_tresh-0.05,pos_tresh+0.15,0.01),function(x){
tmp_edges<-which(cor_rand_r>=x)
if(length(tmp_edges)>0) {
tmp_c<-max(components(graph.data.frame(net_name[tmp_edges,],directed=F))$csize)
tmp_c<-max(components(graph_from_data_frame(net_name[tmp_edges,],directed=F))$csize)
} else {tmp_c<-0}
})
rand_cc_ex<-laply(seq(neg_tresh+0.05,neg_tresh-0.15,-0.01),function(x){
tmp_edges<-which(cor_rand_r<=x)
if(length(tmp_edges)>0) {
tmp_c<-max(components(graph.data.frame(net_name[tmp_edges,],directed=F))$csize)
tmp_c<-max(components(graph_from_data_frame(net_name[tmp_edges,],directed=F))$csize)
} else {tmp_c<-0}
})

Expand Down
4 changes: 2 additions & 2 deletions rscripts/threshold_range.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pos_tresh<-NULL
for(i in seq(0.9,0.01,-0.01)) {
tmp_edges<-which(cor_rand_r>=i)
if(length(tmp_edges)>1) {
tmp_c<-max(components(graph.data.frame(net_name[tmp_edges,],directed=F))$csize)
tmp_c<-max(components(graph_from_data_frame(net_name[tmp_edges,],directed=F))$csize)
if(tmp_c/ncol(mat)>largecp/100) {
pos_tresh<-i
break
Expand All @@ -63,7 +63,7 @@ neg_tresh<-NULL
for(i in seq(-0.9,-0.01,0.01)) {
tmp_edges<-which(cor_rand_r<=i)
if(length(tmp_edges)>1) {
tmp_c<-max(components(graph.data.frame(net_name[tmp_edges,],directed=F))$csize)
tmp_c<-max(components(graph_from_data_frame(net_name[tmp_edges,],directed=F))$csize)
if(tmp_c/ncol(mat)>largecp/100) {
neg_tresh<-i
break
Expand Down

0 comments on commit 6a609da

Please sign in to comment.