Commit c08d6972 authored by Alexandre Delanoë's avatar Alexandre Delanoë Committed by Quentin Lobbé

[PHYLO] cLouvain in IO Monad fix.

parent 044f740c
...@@ -131,7 +131,7 @@ data PhyloGroup = ...@@ -131,7 +131,7 @@ data PhyloGroup =
, _phylo_groupLevelParents :: [Pointer] , _phylo_groupLevelParents :: [Pointer]
, _phylo_groupLevelChilds :: [Pointer] , _phylo_groupLevelChilds :: [Pointer]
} }
deriving (Generic, Show, Eq) deriving (Generic, Show, Eq, Ord)
data PhyloBranch = data PhyloBranch =
PhyloBranch { _phylo_branchId :: (Level,Int) PhyloBranch { _phylo_branchId :: (Level,Int)
......
...@@ -37,7 +37,7 @@ import qualified Data.Set as Set ...@@ -37,7 +37,7 @@ import qualified Data.Set as Set
-- | To apply a Clustering method to a PhyloGraph -- | To apply a Clustering method to a PhyloGraph
graphToClusters :: (Clustering,[Double]) -> PhyloGraph -> [[PhyloGroup]] graphToClusters :: (Clustering,[Double]) -> PhyloGraph -> [[PhyloGroup]]
graphToClusters (clust,param) (nodes,edges) = case clust of graphToClusters (clust,param) (nodes,edges) = case clust of
Louvain -> louvain (nodes,edges) Louvain -> undefined -- louvain (nodes,edges)
RelatedComponents -> relatedComp 0 (head nodes) (tail nodes,edges) [] [] RelatedComponents -> relatedComp 0 (head nodes) (tail nodes,edges) [] []
...@@ -49,4 +49,4 @@ phyloToClusters lvl (prox,param) (clus,param') p = Map.fromList ...@@ -49,4 +49,4 @@ phyloToClusters lvl (prox,param) (clus,param') p = Map.fromList
in if null (fst graph) in if null (fst graph)
then [] then []
else graphToClusters (clus,param') graph) else graphToClusters (clus,param') graph)
(getPhyloPeriods p)) (getPhyloPeriods p))
\ No newline at end of file
...@@ -59,19 +59,20 @@ relatedComp idx curr (nodes,edges) next memo ...@@ -59,19 +59,20 @@ relatedComp idx curr (nodes,edges) next memo
-------------------------------------- --------------------------------------
{-
louvain :: (PhyloNodes,PhyloEdges) -> [Cluster] louvain :: (PhyloNodes,PhyloEdges) -> [Cluster]
louvain (nodes,edges) = undefined louvain (nodes,edges) = undefined
-}
-- louvain :: (PhyloNodes,PhyloEdges) -> [Cluster]
-- louvain (nodes,edges) = map (\community -> map (\node -> nodes !! (l_node_id node)) community) louvain :: (PhyloNodes,PhyloEdges) -> IO [[PhyloGroup]]
-- $ groupBy (l_community_id) louvain (nodes,edges) = map (\community -> map (\node -> nodes !! (l_node_id node)) community)
-- $ cLouvain <$> groupBy (\a b -> (l_community_id a) == (l_community_id b))
-- $ mapKeys (\(x,y) -> (idx x, idx y)) <$> (cLouvain $ mapKeys (\(x,y) -> (idx x, idx y)) $ fromList edges)
-- $ fromList edges where
-- where --------------------------------------
-- -------------------------------------- idx :: PhyloGroup -> Int
-- idx :: PhyloGroup -> Int idx e = case elemIndex e nodes of
-- idx e = case elemIndex e nodes of Nothing -> panic "[ERR][Gargantext.Viz.Phylo.Metrics.Clustering] a node is missing"
-- Nothing -> panic "[ERR][Gargantext.Viz.Phylo.Metrics.Clustering] a node is missing" Just i -> i
-- Just i -> i --------------------------------------
-- --------------------------------------
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment