]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Viz/Graph.hs
[FEAT] adding pipeline.
[gargantext.git] / src / Gargantext / Viz / Graph.hs
1 {-|
2 Module : Gargantext.Viz.Graph
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 {-# LANGUAGE NoImplicitPrelude #-}
13 {-# LANGUAGE TemplateHaskell #-}
14 {-# LANGUAGE DeriveGeneric #-}
15
16 module Gargantext.Viz.Graph
17 where
18
19 import GHC.Generics (Generic)
20 import Data.Aeson.TH (deriveJSON)
21 import Data.Text (Text)
22
23 import Gargantext.Prelude
24 import Gargantext.Core.Utils.Prefix (unPrefix)
25
26 -----------------------------------------------------------
27 data TypeNode = Terms | Unknown
28 deriving (Show, Generic)
29
30 $(deriveJSON (unPrefix "") ''TypeNode)
31
32 data Attributes = Attributes { clust_default :: Int }
33 deriving (Show, Generic)
34 $(deriveJSON (unPrefix "") ''Attributes)
35
36 data Node = Node { n_size :: Int
37 , n_type :: TypeNode
38 , n_id :: Text
39 , n_label :: Text
40 , n_attributes :: Attributes
41 }
42 deriving (Show, Generic)
43 $(deriveJSON (unPrefix "n_") ''Node)
44
45 data Edge = Edge { e_source :: Int
46 , e_target :: Int
47 , e_weight :: Double
48 , e_id :: Int
49 }
50 deriving (Show, Generic)
51 $(deriveJSON (unPrefix "e_") ''Edge)
52
53 data Graph = Graph { g_nodes :: [Node]
54 , g_edges :: [Edge]
55 }
56 deriving (Show, Generic)
57 $(deriveJSON (unPrefix "g_") ''Graph)
58
59 -----------------------------------------------------------
60
61
62
63
64
65
66
67