]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Methods/Graph/Louvain.hs
[Ord] G.C.Methods.Distances
[gargantext.git] / src / Gargantext / Core / Methods / Graph / Louvain.hs
1 {-|
2 Module : Gargantext.Core.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.Core.Methods.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