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
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
Christian Merten
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
Changes
2
Hide 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
...
...
@@ -128,6 +128,7 @@ getGraph uId nId = do
-- graph'' <- computeGraph cId NgramsTerms repo
-- _ <- updateHyperdata nId (HyperdataGraph $ Just graph'')
-- pure graph''
newGraph
<-
liftBase
newEmptyMVar
_
<-
liftBase
$
forkIO
$
putMVar
newGraph
g
...
...
@@ -206,7 +207,7 @@ computeGraph cId nt repo = do
<$>
groupNodesByNgrams
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
pure
graph'
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
5b70b168
...
...
@@ -16,8 +16,8 @@ module Gargantext.Viz.Graph.Tools
where
import
Data.Graph.Clustering.Louvain.Utils
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain
(
hLouvain
,
{-iLouvainMap-}
)
--
import Data.Graph.Clustering.Louvain.CplusPlus (cLouvain)
--
import Data.Graph.Clustering.Louvain (hLouvain, {-iLouvainMap-})
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
)
import
Data.Map
(
Map
)
import
qualified
Data.Set
as
Set
import
Data.Text
(
Text
)
...
...
@@ -53,9 +53,9 @@ cooc2graph' threshold myCooc = distanceMap
cooc2graph
::
Threshold
->
(
Map
(
Text
,
Text
)
Int
)
->
Graph
cooc2graph
threshold
myCooc
=
d
ata2graph
(
Map
.
toList
ti
)
myCooc'
bridgeness'
confluence'
partitions
where
->
IO
Graph
cooc2graph
threshold
myCooc
=
d
o
let
(
ti
,
_
)
=
createIndices
myCooc
myCooc'
=
toIndex
ti
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
where
(
as
,
bs
)
=
List
.
unzip
$
Map
.
keys
distanceMap
n'
=
Set
.
size
$
Set
.
fromList
$
as
<>
bs
ClustersParams
rivers
_
level
=
clustersParams
nodesApprox
ClustersParams
rivers
level
=
clustersParams
nodesApprox
partitions
=
if
(
Map
.
size
distanceMap
>
0
)
--then iLouvainMap 100 10 distanceMap
then
hLouvain
distanceMap
else
panic
"Text.Flow: DistanceMap is empty"
-- True -> trace ("level" <> show level) $ cLouvain level distanceMap
bridgeness'
=
bridgeness
rivers
partitions
distanceMap
partitions
<-
if
(
Map
.
size
distanceMap
>
0
)
--then iLouvainMap 100 10 distanceMap
-- then hLouvain distanceMap
then
cLouvain
level
distanceMap
else
panic
"Text.Flow: DistanceMap is empty"
let
bridgeness'
=
bridgeness
rivers
partitions
distanceMap
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