]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Viz/Graph/Louvain.hs
[CodeType] Adding Python for reading
[gargantext.git] / src / Gargantext / Viz / Graph / Louvain.hs
1 {-|
2 Module : Gargantext.Viz.Graph.Louvain
3 Description :
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12
13 module Gargantext.Viz.Graph.Louvain
14 where
15
16 import Gargantext.Prelude
17 import Data.Map (Map, fromList)
18 import Data.Graph.Clustering.Louvain.Utils (LouvainNode(..))
19
20
21 type LouvainNodeId = Int
22 type CommunityId = Int
23
24 nodeId2comId :: [LouvainNode] -> Map LouvainNodeId CommunityId
25 nodeId2comId ns = fromList [(nId,cId) | LouvainNode nId cId <- ns]
26
27 comId2nodeId :: [LouvainNode] -> Map CommunityId LouvainNodeId
28 comId2nodeId ns = fromList [(cId,nId) | LouvainNode nId cId <- ns]
29
30