Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
gargantext
haskell-gargantext
Commits
5b70b168
Commit
5b70b168
authored
Apr 06, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] back to cLouvain c++ for tests/demo
parent
167f64dc
Pipeline
#807
failed with stage
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
API.hs
src/Gargantext/Viz/Graph/API.hs
+2
-1
Tools.hs
src/Gargantext/Viz/Graph/Tools.hs
+14
-15
No files found.
src/Gargantext/Viz/Graph/API.hs
View file @
5b70b168
...
@@ -129,6 +129,7 @@ getGraph uId nId = do
...
@@ -129,6 +129,7 @@ getGraph uId nId = do
-- _ <- updateHyperdata nId (HyperdataGraph $ Just graph'')
-- _ <- updateHyperdata nId (HyperdataGraph $ Just graph'')
-- pure graph''
-- pure graph''
newGraph
<-
liftBase
newEmptyMVar
newGraph
<-
liftBase
newEmptyMVar
_
<-
liftBase
$
forkIO
$
putMVar
newGraph
g
_
<-
liftBase
$
forkIO
$
putMVar
newGraph
g
g'
<-
liftBase
$
takeMVar
newGraph
g'
<-
liftBase
$
takeMVar
newGraph
...
@@ -206,7 +207,7 @@ computeGraph cId nt repo = do
...
@@ -206,7 +207,7 @@ computeGraph cId nt repo = do
<$>
groupNodesByNgrams
ngs
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
Map
.
keys
ngs
)
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
Map
.
keys
ngs
)
let
graph
=
cooc2graph
0
myCooc
graph
<-
liftBase
$
cooc2graph
0
myCooc
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
pure
graph'
pure
graph'
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
5b70b168
...
@@ -16,8 +16,8 @@ module Gargantext.Viz.Graph.Tools
...
@@ -16,8 +16,8 @@ module Gargantext.Viz.Graph.Tools
where
where
import
Data.Graph.Clustering.Louvain.Utils
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain.Utils
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain
(
hLouvain
,
{-iLouvainMap-}
)
--
import Data.Graph.Clustering.Louvain (hLouvain, {-iLouvainMap-})
--
import Data.Graph.Clustering.Louvain.CplusPlus (cLouvain)
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
)
import
Data.Map
(
Map
)
import
Data.Map
(
Map
)
import
qualified
Data.Set
as
Set
import
qualified
Data.Set
as
Set
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
...
@@ -53,9 +53,9 @@ cooc2graph' threshold myCooc = distanceMap
...
@@ -53,9 +53,9 @@ cooc2graph' threshold myCooc = distanceMap
cooc2graph
::
Threshold
cooc2graph
::
Threshold
->
(
Map
(
Text
,
Text
)
Int
)
->
(
Map
(
Text
,
Text
)
Int
)
->
Graph
->
IO
Graph
cooc2graph
threshold
myCooc
=
d
ata2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
cooc2graph
threshold
myCooc
=
d
o
where
let
(
ti
,
_
)
=
createIndices
myCooc
(
ti
,
_
)
=
createIndices
myCooc
myCooc'
=
toIndex
ti
myCooc
myCooc'
=
toIndex
ti
myCooc
matCooc
=
map2mat
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
1
)
myCooc'
matCooc
=
map2mat
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
1
)
myCooc'
...
@@ -67,21 +67,20 @@ cooc2graph threshold myCooc = data2graph (Map.toList ti) myCooc' bridgeness' con
...
@@ -67,21 +67,20 @@ cooc2graph threshold myCooc = data2graph (Map.toList ti) myCooc' bridgeness' con
where
where
(
as
,
bs
)
=
List
.
unzip
$
Map
.
keys
distanceMap
(
as
,
bs
)
=
List
.
unzip
$
Map
.
keys
distanceMap
n'
=
Set
.
size
$
Set
.
fromList
$
as
<>
bs
n'
=
Set
.
size
$
Set
.
fromList
$
as
<>
bs
ClustersParams
rivers
_
level
=
clustersParams
nodesApprox
ClustersParams
rivers
level
=
clustersParams
nodesApprox
partitions
=
if
(
Map
.
size
distanceMap
>
0
)
partitions
<-
if
(
Map
.
size
distanceMap
>
0
)
--then iLouvainMap 100 10 distanceMap
--then iLouvainMap 100 10 distanceMap
then
hLouvain
distanceMap
-- then hLouvain distanceMap
then
cLouvain
level
distanceMap
else
panic
"Text.Flow: DistanceMap is empty"
else
panic
"Text.Flow: DistanceMap is empty"
-- True -> trace ("level" <> show level) $ cLouvain level distanceMap
let
bridgeness'
=
bridgeness
rivers
partitions
distanceMap
bridgeness'
=
bridgeness
rivers
partitions
distanceMap
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
pure
$
data2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
...
...
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