Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
0e497373
Commit
0e497373
authored
Mar 19, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optims]
parent
dc1820d0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
16 deletions
+40
-16
Prelude.hs
src/Gargantext/Prelude.hs
+21
-1
API.hs
src/Gargantext/Viz/Graph/API.hs
+2
-2
Bridgeness.hs
src/Gargantext/Viz/Graph/Bridgeness.hs
+1
-1
IGraph.hs
src/Gargantext/Viz/Graph/IGraph.hs
+3
-0
Tools.hs
src/Gargantext/Viz/Graph/Tools.hs
+10
-11
Cluster.hs
src/Gargantext/Viz/Phylo/Cluster.hs
+1
-0
stack.yaml
stack.yaml
+2
-1
No files found.
src/Gargantext/Prelude.hs
View file @
0e497373
...
...
@@ -31,10 +31,11 @@ module Gargantext.Prelude
)
where
import
Control.Monad.IO.Class
(
liftIO
,
MonadIO
)
import
Control.Concurrent
(
newEmptyMVar
,
takeMVar
,
putMVar
,
forkIO
)
import
GHC.Exts
(
sortWith
)
import
GHC.Err.Located
(
undefined
)
import
GHC.Real
(
round
)
import
Control.Monad.IO.Class
(
MonadIO
)
import
Data.Maybe
(
isJust
,
fromJust
,
maybe
)
import
Data.Text
(
Text
)
import
Protolude
(
Bool
(
True
,
False
),
Int
,
Int64
,
Double
,
Integer
...
...
@@ -305,3 +306,22 @@ fib n = fib (n-1) + fib (n-2)
-----------------------------------------------------------------------
-- Memory Optimization
inMVarIO
::
MonadIO
m
=>
m
b
->
m
b
inMVarIO
f
=
do
mVar
<-
liftIO
newEmptyMVar
zVar
<-
f
_
<-
liftIO
$
forkIO
$
putMVar
mVar
zVar
liftIO
$
takeMVar
mVar
inMVar
::
b
->
IO
b
inMVar
f
=
do
mVar
<-
newEmptyMVar
let
zVar
=
f
_
<-
liftIO
$
forkIO
$
putMVar
mVar
zVar
liftIO
$
takeMVar
mVar
src/Gargantext/Viz/Graph/API.hs
View file @
0e497373
...
...
@@ -99,7 +99,7 @@ getGraph uId nId = do
newGraph
<-
liftIO
newEmptyMVar
g
<-
case
graph
of
Nothing
->
do
graph'
<-
computeGraph
cId
NgramsTerms
repo
graph'
<-
inMVarIO
$
computeGraph
cId
NgramsTerms
repo
_
<-
insertGraph
cId
uId'
(
HyperdataGraph
$
Just
graph'
)
pure
graph'
...
...
@@ -134,7 +134,7 @@ computeGraph cId nt repo = do
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
Map
.
keys
ngs
)
graph
<-
liftIO
$
cooc2graph
0
myCooc
graph
<-
liftIO
$
inMVarIO
$
cooc2graph
0
myCooc
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
pure
graph'
...
...
src/Gargantext/Viz/Graph/Bridgeness.hs
View file @
0e497373
...
...
@@ -25,7 +25,7 @@ import Data.Map (Map, fromListWith, lookup, fromList, delete, toList, mapKeys, m
import
qualified
Data.Map
as
DM
import
Data.Maybe
(
fromJust
)
import
Data.List
(
concat
,
sortOn
)
import
Data.Graph.Clustering.Louvain.
CplusPlu
s
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain.
Util
s
(
LouvainNode
(
..
))
-- TODO mv in Louvain Lib
...
...
src/Gargantext/Viz/Graph/IGraph.hs
View file @
0e497373
...
...
@@ -8,6 +8,9 @@ Portability : POSIX
Main IGraph funs/types to ease portability with FGL.
Reference:
* Gábor Csárdi, Tamás Nepusz: The igraph software package for complex network research. InterJournal Complex Systems, 1695, 2006.
-}
{-# LANGUAGE NoImplicitPrelude #-}
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
0e497373
...
...
@@ -15,10 +15,8 @@ Portability : POSIX
module
Gargantext.Viz.Graph.Tools
where
import
Control.Monad.IO.Class
(
liftIO
)
import
Control.Concurrent
(
newEmptyMVar
,
takeMVar
,
putMVar
,
forkIO
)
import
Debug.Trace
(
trace
)
import
Data.Graph.Clustering.Louvain.
CplusPlu
s
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain.
Util
s
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
)
import
Data.Map
(
Map
)
import
qualified
Data.Set
as
Set
...
...
@@ -70,20 +68,21 @@ cooc2graph threshold myCooc = do
n'
=
Set
.
size
$
Set
.
fromList
$
as
<>
bs
ClustersParams
rivers
level
=
{-trace ("nodesApprox: " <> show nodesApprox) $-}
clustersParams
nodesApprox
partitionsV
<-
liftIO
newEmptyMVar
partitions'
<-
case
Map
.
size
distanceMap
>
0
of
partitions
<-
inMVarIO
$
case
Map
.
size
distanceMap
>
0
of
True
->
trace
(
"level"
<>
show
level
)
$
cLouvain
level
distanceMap
False
->
panic
"Text.Flow: DistanceMap is empty"
_
<-
liftIO
$
forkIO
$
putMVar
partitionsV
partitions'
partitions
<-
liftIO
$
takeMVar
partitionsV
let
bridgeness'
=
{-trace ("rivers: " <> show rivers) $-}
bridgeness'
<-
trace
"bridgeness"
$
inMVar
$
{-trace ("rivers: " <> show rivers) $-}
bridgeness
rivers
partitions
distanceMap
let
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
confluence'
<-
trace
"confluence"
$
inMVar
$
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
r
<-
trace
"data2graph"
$
inMVarIO
$
data2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
pure
r
data2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
data
ClustersParams
=
ClustersParams
{
bridgness
::
Double
...
...
src/Gargantext/Viz/Phylo/Cluster.hs
View file @
0e497373
...
...
@@ -19,6 +19,7 @@ module Gargantext.Viz.Phylo.Cluster
where
import
Control.Parallel.Strategies
import
Data.Graph.Clustering.Louvain.CplusPlus
import
Data.Graph.Clustering.Louvain.Utils
(
LouvainNode
(
..
))
import
Data.List
(
null
,
concat
,
sort
,
intersect
,(
++
),
elemIndex
,
groupBy
,
nub
,
union
,
(
\\
),
(
!!
))
import
Data.Map
(
Map
,
fromList
,
mapKeys
)
import
Data.Tuple
(
fst
)
...
...
stack.yaml
View file @
0e497373
...
...
@@ -4,6 +4,7 @@ extra-package-dbs: []
packages
:
-
.
#- 'deps/servant-job'
#- 'deps/clustering-louvain'
docker
:
enable
:
false
...
...
@@ -49,7 +50,7 @@ extra-deps:
-
git
:
https://github.com/np/servant-job.git
commit
:
4016c76398a56e1a352a45b3ee9d698dd0dd2597
-
git
:
https://gitlab.iscpif.fr/gargantext/clustering-louvain.git
commit
:
e5814cbfa71f43b0a453efb65f476240d7d51a53
commit
:
f8fd33e4e9639730d47cd02b223a0f8fbbbfe975
-
git
:
https://github.com/np/patches-map
commit
:
8c6f38c4844ead53e664cf9c82ba461715dbe445
-
git
:
https://github.com/delanoe/haskell-opaleye.git
#- opaleye-0.6.7002.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment