2 Module : Gargantext.Core.Viz.Graph.Louvain
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
13 module Gargantext.Core.Viz.Graph.Louvain
16 import Gargantext.Prelude
17 import Data.Map (Map, fromList)
18 import Data.Graph.Clustering.Louvain.Utils (LouvainNode(..))
21 type LouvainNodeId = Int
22 type CommunityId = Int
24 nodeId2comId :: [LouvainNode] -> Map LouvainNodeId CommunityId
25 nodeId2comId ns = fromList [(nId,cId) | LouvainNode nId cId <- ns]
27 comId2nodeId :: [LouvainNode] -> Map CommunityId LouvainNodeId
28 comId2nodeId ns = fromList [(cId,nId) | LouvainNode nId cId <- ns]