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
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
0c0dd385
Verified
Commit
0c0dd385
authored
Jun 28, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-openalex
parents
17c2572d
d9ce5101
Pipeline
#4306
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
39 deletions
+6
-39
PhyloExport.hs
src/Gargantext/Core/Viz/Phylo/PhyloExport.hs
+2
-36
SynchronicClustering.hs
src/Gargantext/Core/Viz/Phylo/SynchronicClustering.hs
+4
-3
No files found.
src/Gargantext/Core/Viz/Phylo/PhyloExport.hs
View file @
0c0dd385
...
@@ -28,7 +28,6 @@ import Gargantext.Core.Viz.Phylo.PhyloTools
...
@@ -28,7 +28,6 @@ import Gargantext.Core.Viz.Phylo.PhyloTools
import
Gargantext.Core.Viz.Phylo.TemporalMatching
(
filterDocs
,
filterDiago
,
reduceDiagos
,
toSimilarity
,
getNextPeriods
)
import
Gargantext.Core.Viz.Phylo.TemporalMatching
(
filterDocs
,
filterDiago
,
reduceDiagos
,
toSimilarity
,
getNextPeriods
)
import
Gargantext.Prelude
hiding
(
scale
)
import
Gargantext.Prelude
hiding
(
scale
)
import
Prelude
(
writeFile
)
import
Prelude
(
writeFile
)
import
Protolude
(
floor
)
import
System.FilePath
import
System.FilePath
import
qualified
Data.GraphViz.Attributes.HTML
as
H
import
qualified
Data.GraphViz.Attributes.HTML
as
H
import
qualified
Data.Text
as
Text
import
qualified
Data.Text
as
Text
...
@@ -78,37 +77,6 @@ branchIdToDotId bId = (fromStrict . Text.pack) $ "branch" <> show (snd bId)
...
@@ -78,37 +77,6 @@ branchIdToDotId bId = (fromStrict . Text.pack) $ "branch" <> show (snd bId)
periodIdToDotId
::
Period
->
DotId
periodIdToDotId
::
Period
->
DotId
periodIdToDotId
prd
=
(
fromStrict
.
Text
.
pack
)
$
"period"
<>
show
(
fst
prd
)
<>
show
(
snd
prd
)
periodIdToDotId
prd
=
(
fromStrict
.
Text
.
pack
)
$
"period"
<>
show
(
fst
prd
)
<>
show
(
snd
prd
)
groupToTable
::
Vector
Ngrams
->
PhyloGroup
->
H
.
Label
groupToTable
fdt
g
=
H
.
Table
H
.
HTable
{
H
.
tableFontAttrs
=
Just
[
H
.
PointSize
14
,
H
.
Align
H
.
HLeft
]
,
H
.
tableAttrs
=
[
H
.
Border
0
,
H
.
CellBorder
0
,
H
.
BGColor
(
toColor
White
)]
,
H
.
tableRows
=
[
header
]
<>
[
H
.
Cells
[
H
.
LabelCell
[
H
.
Height
10
]
$
H
.
Text
[
H
.
Str
$
fromStrict
""
]]]
<>
(
map
ngramsToRow
$
splitEvery
4
$
reverse
$
sortOn
(
snd
.
snd
)
$
zip
(
ngramsToText
fdt
(
g
^.
phylo_groupNgrams
))
$
zip
((
g
^.
phylo_groupMeta
)
!
"dynamics"
)
((
g
^.
phylo_groupMeta
)
!
"inclusion"
))}
where
--------------------------------------
ngramsToRow
::
[(
Ngrams
,
(
Double
,
Double
))]
->
H
.
Row
ngramsToRow
ns
=
H
.
Cells
$
map
(
\
(
n
,
(
d
,
_
))
->
H
.
LabelCell
[
H
.
Align
H
.
HLeft
,
dynamicToColor
$
floor
d
]
$
H
.
Text
[
H
.
Str
$
fromStrict
n
])
ns
--------------------------------------
header
::
H
.
Row
header
=
H
.
Cells
[
H
.
LabelCell
[
pickLabelColor
$
floor
<$>
((
g
^.
phylo_groupMeta
)
!
"dynamics"
)]
$
H
.
Text
[
H
.
Str
$
((
fromStrict
.
Text
.
toUpper
)
$
g
^.
phylo_groupLabel
)
<>
fromStrict
" ( "
<>
(
pack
$
show
(
fst
$
g
^.
phylo_groupPeriod
))
<>
fromStrict
" , "
<>
(
pack
$
show
(
snd
$
g
^.
phylo_groupPeriod
))
<>
fromStrict
" ) "
<>
(
pack
$
show
(
getGroupId
g
))]]
--------------------------------------
branchToDotNode
::
PhyloBranch
->
Int
->
Dot
DotId
branchToDotNode
::
PhyloBranch
->
Int
->
Dot
DotId
branchToDotNode
b
bId
=
branchToDotNode
b
bId
=
node
(
branchIdToDotId
$
b
^.
branch_id
)
node
(
branchIdToDotId
$
b
^.
branch_id
)
...
@@ -116,8 +84,7 @@ branchToDotNode b bId =
...
@@ -116,8 +84,7 @@ branchToDotNode b bId =
,
FontName
"Arial"
,
FontName
"Arial"
,
FontSize
40
,
FontSize
40
,
Shape
Egg
,
Shape
Egg
,
Style
[
SItem
Bold
[]
]
,
Style
[
SItem
Bold
[]
]
]
,
Label
(
toDotLabel
$
b
^.
branch_label
)
]
<>
(
metaToAttr
$
b
^.
branch_meta
)
<>
(
metaToAttr
$
b
^.
branch_meta
)
<>
[
toAttr
"nodeType"
"branch"
<>
[
toAttr
"nodeType"
"branch"
,
toAttr
"bId"
(
pack
$
show
bId
)
,
toAttr
"bId"
(
pack
$
show
bId
)
...
@@ -143,8 +110,7 @@ periodToDotNode prd prd' =
...
@@ -143,8 +110,7 @@ periodToDotNode prd prd' =
groupToDotNode
::
Vector
Ngrams
->
PhyloGroup
->
Int
->
Dot
DotId
groupToDotNode
::
Vector
Ngrams
->
PhyloGroup
->
Int
->
Dot
DotId
groupToDotNode
fdt
g
bId
=
groupToDotNode
fdt
g
bId
=
node
(
groupIdToDotId
$
getGroupId
g
)
node
(
groupIdToDotId
$
getGroupId
g
)
([
FontName
"Arial"
,
Shape
Square
,
penWidth
4
,
toLabel
(
groupToTable
fdt
g
)]
([
toAttr
"nodeType"
"group"
<>
[
toAttr
"nodeType"
"group"
,
toAttr
"gid"
(
groupIdToDotId
$
getGroupId
g
)
,
toAttr
"gid"
(
groupIdToDotId
$
getGroupId
g
)
,
toAttr
"from"
(
pack
$
show
(
fst
$
g
^.
phylo_groupPeriod
))
,
toAttr
"from"
(
pack
$
show
(
fst
$
g
^.
phylo_groupPeriod
))
,
toAttr
"to"
(
pack
$
show
(
snd
$
g
^.
phylo_groupPeriod
))
,
toAttr
"to"
(
pack
$
show
(
snd
$
g
^.
phylo_groupPeriod
))
...
...
src/Gargantext/Core/Viz/Phylo/SynchronicClustering.hs
View file @
0c0dd385
...
@@ -22,6 +22,7 @@ import Gargantext.Core.Viz.Phylo.PhyloExport (processDynamics)
...
@@ -22,6 +22,7 @@ import Gargantext.Core.Viz.Phylo.PhyloExport (processDynamics)
import
Gargantext.Core.Viz.Phylo.PhyloTools
import
Gargantext.Core.Viz.Phylo.PhyloTools
import
Gargantext.Core.Viz.Phylo.TemporalMatching
(
weightedLogJaccard'
,
filterDiago
,
reduceDiagos
)
import
Gargantext.Core.Viz.Phylo.TemporalMatching
(
weightedLogJaccard'
,
filterDiago
,
reduceDiagos
)
import
Gargantext.Prelude
import
Gargantext.Prelude
-- import Debug.Trace (trace)
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
...
@@ -175,13 +176,13 @@ reduceGroups prox sync docs diagos branch =
...
@@ -175,13 +176,13 @@ reduceGroups prox sync docs diagos branch =
$
unionWith
(
\
v1
v2
->
if
v1
>=
v2
$
unionWith
(
\
v1
v2
->
if
v1
>=
v2
then
v1
then
v1
else
v2
)
edgesLeft
edgesRight
else
v2
)
edgesLeft
edgesRight
-- 3) reduce the graph a a set of related components
clusters
=
toRelatedComponents
groups
mergedEdges
in
map
(
\
comp
->
in
map
(
\
comp
->
-- 4) add to each groups their futur level parent group
-- 4) add to each groups their futur level parent group
let
parentId
=
toParentId
(
head'
"parentId"
comp
)
let
parentId
=
toParentId
(
head'
"parentId"
comp
)
in
map
(
\
g
->
g
&
phylo_groupScaleParents
%~
(
++
[(
parentId
,
1
)])
)
comp
)
in
map
(
\
g
->
g
&
phylo_groupScaleParents
%~
(
++
[(
parentId
,
1
)])
)
comp
)
-- 3) reduce the graph a a set of related components
$
clusters
)
periods
$
toRelatedComponents
groups
mergedEdges
)
periods
chooseClusteringStrategy
::
Synchrony
->
[[
PhyloGroup
]]
->
[[
PhyloGroup
]]
chooseClusteringStrategy
::
Synchrony
->
[[
PhyloGroup
]]
->
[[
PhyloGroup
]]
chooseClusteringStrategy
sync
branches
=
case
sync
of
chooseClusteringStrategy
sync
branches
=
case
sync
of
...
...
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