Skip to content

Commit

Permalink
check compatibility with igraph cluster_leiden #1
Browse files Browse the repository at this point in the history
  • Loading branch information
TomKellyGenetics committed Nov 5, 2020
1 parent 52fb36f commit e4d8650
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/leiden.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ leiden.igraph <- function(object,
}
}

#check whether compatible with igraph implementations in R
if(is_directed(object) && !is_bipartite(object)){
#coerce to undirected graph object if possible
if(all(which_mutual(object) || which_loop(object)) || partition_type == "CPMVertexPartition"){
object <- as.undirected(object, mode = "each")
}
}
call_igraph <- !is_directed(snn_graph) && !is_bipartite(object) && legacy == FALSE && partition_type == "CPMVertexPartition" || partition_type == "ModularityVertexPartition"


#import python modules with reticulate
numpy <- reticulate::import("numpy", delay_load = TRUE)
leidenalg <- import("leidenalg", delay_load = TRUE)
Expand Down

0 comments on commit e4d8650

Please sign in to comment.