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
157
Issues
157
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
503f79e5
Commit
503f79e5
authored
Nov 04, 2024
by
Alexandre Delanoë
1
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/689-dev-graph-legend-show-all-clusters' into dev
parents
7b630704
fff00f20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+13
-5
Tools.hs
src/Gargantext/Core/Viz/Graph/Tools.hs
+9
-1
No files found.
src/Gargantext/Core/Viz/Graph/API.hs
View file @
503f79e5
...
@@ -75,8 +75,9 @@ getGraph nId = do
...
@@ -75,8 +75,9 @@ getGraph nId = do
let
defaultBridgenessMethod
=
BridgenessMethod_Basic
let
defaultBridgenessMethod
=
BridgenessMethod_Basic
graph'
<-
computeGraph
cId
defaultPartitionMethod
defaultBridgenessMethod
(
withMetric
defaultMetric
)
defaultEdgesStrength
(
NgramsTerms
,
NgramsTerms
)
repo
graph'
<-
computeGraph
cId
defaultPartitionMethod
defaultBridgenessMethod
(
withMetric
defaultMetric
)
defaultEdgesStrength
(
NgramsTerms
,
NgramsTerms
)
repo
mt
<-
defaultGraphMetadata
cId
listId
"Title"
repo
defaultMetric
defaultEdgesStrength
mt
<-
defaultGraphMetadata
cId
listId
"Title"
repo
defaultMetric
defaultEdgesStrength
let
mt'
=
set
gm_legend
(
generateLegend
graph'
)
mt
let
let
graph''
=
set
graph_metadata
(
Just
mt
)
graph'
graph''
=
set
graph_metadata
(
Just
mt
'
)
graph'
hg
=
HyperdataGraphAPI
graph''
camera
hg
=
HyperdataGraphAPI
graph''
camera
-- _ <- updateHyperdata nId hg
-- _ <- updateHyperdata nId hg
_
<-
updateHyperdata
nId
(
HyperdataGraph
(
Just
graph''
)
camera
)
_
<-
updateHyperdata
nId
(
HyperdataGraph
(
Just
graph''
)
camera
)
...
@@ -126,20 +127,27 @@ recomputeGraph nId partitionMethod bridgeMethod maybeSimilarity maybeStrength nt
...
@@ -126,20 +127,27 @@ recomputeGraph nId partitionMethod bridgeMethod maybeSimilarity maybeStrength nt
let
computeG
mt
=
do
let
computeG
mt
=
do
!
g
<-
computeGraph
cId
partitionMethod
bridgeMethod
similarity
strength
(
nt1
,
nt2
)
repo
!
g
<-
computeGraph
cId
partitionMethod
bridgeMethod
similarity
strength
(
nt1
,
nt2
)
repo
let
g'
=
set
graph_metadata
mt
g
let
mt'
=
set
gm_legend
(
generateLegend
g
)
mt
let
g'
=
set
graph_metadata
(
Just
mt'
)
g
_nentries
<-
updateHyperdata
nId
(
HyperdataGraph
(
Just
g'
)
camera
)
_nentries
<-
updateHyperdata
nId
(
HyperdataGraph
(
Just
g'
)
camera
)
pure
g'
pure
g'
case
graph
of
case
graph
of
Nothing
->
do
Nothing
->
do
mt
<-
defaultGraphMetadata
cId
listId
"Title"
repo
(
fromMaybe
Order1
maybeSimilarity
)
strength
mt
<-
defaultGraphMetadata
cId
listId
"Title"
repo
(
fromMaybe
Order1
maybeSimilarity
)
strength
g
<-
computeG
$
Just
mt
g
<-
computeG
mt
pure
$
trace
(
"[G.V.G.API.recomputeGraph] Graph empty, computed"
::
Text
)
g
pure
$
trace
(
"[G.V.G.API.recomputeGraph] Graph empty, computed"
::
Text
)
g
Just
graph'
->
if
(
listVersion
==
Just
v
)
&&
(
not
force'
)
Just
graph'
->
if
(
listVersion
==
Just
v
)
&&
(
not
force'
)
then
pure
graph'
then
pure
graph'
else
do
else
do
g
<-
computeG
graphMetadata
case
graphMetadata
of
pure
$
trace
(
"[G.V.G.API] Graph exists, recomputing"
::
Text
)
g
Nothing
->
do
mt
<-
defaultGraphMetadata
cId
listId
"Title"
repo
(
fromMaybe
Order1
maybeSimilarity
)
strength
g
<-
computeG
mt
pure
$
trace
(
"[G.V.G.API] Graph exists, no metadata, recomputing"
::
Text
)
g
Just
mt
->
do
g
<-
computeG
mt
pure
$
trace
(
"[G.V.G.API] Graph exists, recomputing"
::
Text
)
g
-- TODO remove repo
-- TODO remove repo
...
...
src/Gargantext/Core/Viz/Graph/Tools.hs
View file @
503f79e5
...
@@ -34,7 +34,7 @@ import Gargantext.Core.Viz.Graph.Bridgeness (bridgeness, Bridgeness(..), Partiti
...
@@ -34,7 +34,7 @@ import Gargantext.Core.Viz.Graph.Bridgeness (bridgeness, Bridgeness(..), Partiti
import
Gargantext.Core.Viz.Graph.Index
(
createIndices
,
toIndex
,
map2mat
,
mat2map
,
Index
,
MatrixShape
(
..
))
import
Gargantext.Core.Viz.Graph.Index
(
createIndices
,
toIndex
,
map2mat
,
mat2map
,
Index
,
MatrixShape
(
..
))
import
Gargantext.Core.Viz.Graph.Tools.IGraph
(
mkGraphUfromEdges
,
spinglass
,
spinglass'
)
import
Gargantext.Core.Viz.Graph.Tools.IGraph
(
mkGraphUfromEdges
,
spinglass
,
spinglass'
)
import
Gargantext.Core.Viz.Graph.Tools.Infomap
(
infomap
)
import
Gargantext.Core.Viz.Graph.Tools.Infomap
(
infomap
)
import
Gargantext.Core.Viz.Graph.Types
(
Attributes
(
..
),
Edge
(
..
),
Graph
(
..
),
MultiPartite
(
..
),
Node
(
..
),
Partite
(
..
),
Strength
(
..
))
import
Gargantext.Core.Viz.Graph.Types
(
Attributes
(
..
),
Edge
(
..
),
Graph
(
..
),
MultiPartite
(
..
),
Node
(
..
),
Partite
(
..
),
Strength
(
..
)
,
LegendField
(
..
)
)
import
Gargantext.Core.Viz.Graph.Utils
(
edgesFilter
,
nodesFilter
)
import
Gargantext.Core.Viz.Graph.Utils
(
edgesFilter
,
nodesFilter
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Graph.BAC.ProxemyOptim
qualified
as
BAC
import
Graph.BAC.ProxemyOptim
qualified
as
BAC
...
@@ -377,3 +377,11 @@ filterByNeighbours threshold distanceMap = filteredMap
...
@@ -377,3 +377,11 @@ filterByNeighbours threshold distanceMap = filteredMap
$
Map
.
filterWithKey
(
\
(
from'
,
_
)
_
->
idx
==
from'
)
distanceMap
$
Map
.
filterWithKey
(
\
(
from'
,
_
)
_
->
idx
==
from'
)
distanceMap
in
List
.
take
(
round
threshold
)
selected
in
List
.
take
(
round
threshold
)
selected
)
indexes
)
indexes
generateLegend
::
Graph
->
[
LegendField
]
generateLegend
(
Graph
{
_graph_nodes
=
nodes
})
=
List
.
sortBy
(
\
(
LegendField
{
_lf_id
=
a
})
(
LegendField
{
_lf_id
=
b
})
->
compare
a
b
)
$
foldl'
f
[]
nodes
where
f
::
[
LegendField
]
->
Node
->
[
LegendField
]
f
acc
(
Node
{
node_attributes
=
Attributes
{
clust_default
=
i
}})
=
case
List
.
find
(
\
(
LegendField
{
_lf_id
})
->
_lf_id
==
i
)
acc
of
Just
_
->
acc
Nothing
->
acc
++
[
LegendField
{
_lf_id
=
i
,
_lf_label
=
"Cluster"
<>
show
i
,
_lf_color
=
"#FFF"
}]
Przemyslaw Kaminski
@cgenie
mentioned in commit
83c8708f
·
Nov 07, 2024
mentioned in commit
83c8708f
mentioned in commit 83c8708f08e563243a0ff361e51a46c7d7822bb7
Toggle commit list
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