Commit e243b4f1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] graph clustering.

parent cda8b3b9
Pipeline #667 failed with stage
...@@ -17,7 +17,7 @@ module Gargantext.Text.List ...@@ -17,7 +17,7 @@ module Gargantext.Text.List
where where
import Data.Either (partitionEithers, Either(..)) import Data.Either (partitionEithers, Either(..))
import Debug.Trace (trace) -- import Debug.Trace (trace)
import Data.Map (Map) import Data.Map (Map)
import Data.Set (Set) import Data.Set (Set)
import Data.Text (Text) import Data.Text (Text)
...@@ -161,7 +161,7 @@ toList stop l n = case stop n of ...@@ -161,7 +161,7 @@ toList stop l n = case stop n of
toTermList :: Int -> Int -> (a -> Bool) -> [a] -> [(ListType, a)] toTermList :: Int -> Int -> (a -> Bool) -> [a] -> [(ListType, a)]
toTermList _ _ _ [] = [] toTermList _ _ _ [] = []
toTermList a b stop ns = trace ("computing toTermList") $ toTermList a b stop ns = -- trace ("computing toTermList") $
map (toList stop CandidateTerm) xs map (toList stop CandidateTerm) xs
<> map (toList stop GraphTerm) ys <> map (toList stop GraphTerm) ys
<> toTermList a b stop zs <> toTermList a b stop zs
......
...@@ -24,6 +24,7 @@ Portability : POSIX ...@@ -24,6 +24,7 @@ Portability : POSIX
module Gargantext.Viz.Graph.API module Gargantext.Viz.Graph.API
where where
import Debug.Trace (trace)
import Control.Lens (set, (^.), _Just, (^?)) import Control.Lens (set, (^.), _Just, (^?))
import Control.Monad.IO.Class (liftIO) import Control.Monad.IO.Class (liftIO)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
...@@ -77,7 +78,8 @@ getGraph uId nId = do ...@@ -77,7 +78,8 @@ getGraph uId nId = do
let cId = maybe (panic "[ERR:G.V.G.API] Node has no parent") let cId = maybe (panic "[ERR:G.V.G.API] Node has no parent")
identity identity
$ nodeGraph ^. node_parentId $ nodeGraph ^. node_parentId
case graph of
g <- case graph of
Nothing -> do Nothing -> do
graph' <- computeGraph cId NgramsTerms v graph' <- computeGraph cId NgramsTerms v
_ <- insertGraph cId uId' (HyperdataGraph $ Just graph') _ <- insertGraph cId uId' (HyperdataGraph $ Just graph')
...@@ -89,6 +91,8 @@ getGraph uId nId = do ...@@ -89,6 +91,8 @@ getGraph uId nId = do
graph'' <- computeGraph cId NgramsTerms v graph'' <- computeGraph cId NgramsTerms v
_ <- updateHyperdata nId (HyperdataGraph $ Just graph'') _ <- updateHyperdata nId (HyperdataGraph $ Just graph'')
pure graph'' pure graph''
pure $ trace ("salut" <> show g) $ g
-- TODO use Database Monad only here ? -- TODO use Database Monad only here ?
computeGraph :: CorpusId -> NgramsType -> Int -> GargServer (Get '[JSON] Graph) computeGraph :: CorpusId -> NgramsType -> Int -> GargServer (Get '[JSON] Graph)
......
...@@ -74,8 +74,8 @@ data ClustersParams = ClustersParams { bridgness :: Double ...@@ -74,8 +74,8 @@ data ClustersParams = ClustersParams { bridgness :: Double
clustersParams :: Int -> ClustersParams clustersParams :: Int -> ClustersParams
clustersParams x = ClustersParams (fromIntegral x) y clustersParams x = ClustersParams (fromIntegral x) y
where where
y | x < 100 = "0.0001" y | x < 100 = "0.01"
| x < 350 = "0.001" | x < 350 = "0.01"
| x < 500 = "0.01" | x < 500 = "0.01"
| x < 1000 = "0.1" | x < 1000 = "0.1"
| otherwise = "1" | otherwise = "1"
......
...@@ -4,7 +4,6 @@ extra-package-dbs: [] ...@@ -4,7 +4,6 @@ extra-package-dbs: []
packages: packages:
- . - .
docker: docker:
enable: false enable: false
repo: 'fpco/stack-build:lts-14.6-garg' repo: 'fpco/stack-build:lts-14.6-garg'
...@@ -40,7 +39,7 @@ extra-deps: ...@@ -40,7 +39,7 @@ extra-deps:
- git: https://github.com/np/servant-job.git - git: https://github.com/np/servant-job.git
commit: 8557bfc9472a1b2be0b7bc632c23701ba5f44bf8 commit: 8557bfc9472a1b2be0b7bc632c23701ba5f44bf8
- git: https://gitlab.iscpif.fr/gargantext/clustering-louvain.git - git: https://gitlab.iscpif.fr/gargantext/clustering-louvain.git
commit: b29040ce741629d61cc63e8ba97e75bf0944979e commit: e5814cbfa71f43b0a453efb65f476240d7d51a53
- git: https://github.com/np/patches-map - git: https://github.com/np/patches-map
commit: 8c6f38c4844ead53e664cf9c82ba461715dbe445 commit: 8c6f38c4844ead53e664cf9c82ba461715dbe445
- git: https://github.com/delanoe/haskell-opaleye.git #- opaleye-0.6.7002.0 - git: https://github.com/delanoe/haskell-opaleye.git #- opaleye-0.6.7002.0
......
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