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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
d1a75af8
Commit
d1a75af8
authored
Nov 22, 2021
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[node] fix node children to be maybe type
This caused errors when snapshotting graph.
parent
effff367
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
Graph.hs
src/Gargantext/Core/Viz/Graph.hs
+5
-5
Tools.hs
src/Gargantext/Core/Viz/Graph/Tools.hs
+1
-1
No files found.
src/Gargantext/Core/Viz/Graph.hs
View file @
d1a75af8
...
@@ -51,7 +51,7 @@ data Node = Node { node_size :: Int
...
@@ -51,7 +51,7 @@ data Node = Node { node_size :: Int
,
node_x_coord
::
Double
,
node_x_coord
::
Double
,
node_y_coord
::
Double
,
node_y_coord
::
Double
,
node_attributes
::
Attributes
,
node_attributes
::
Attributes
,
node_children
::
[
Text
]
,
node_children
::
Maybe
[
Text
]
}
}
deriving
(
Show
,
Generic
)
deriving
(
Show
,
Generic
)
$
(
deriveJSON
(
unPrefix
"node_"
)
''
N
ode
)
$
(
deriveJSON
(
unPrefix
"node_"
)
''
N
ode
)
...
@@ -129,7 +129,7 @@ instance Arbitrary Graph where
...
@@ -129,7 +129,7 @@ instance Arbitrary Graph where
arbitrary
=
elements
$
[
defaultGraph
]
arbitrary
=
elements
$
[
defaultGraph
]
defaultGraph
::
Graph
defaultGraph
::
Graph
defaultGraph
=
Graph
{
_graph_nodes
=
[
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
4
,
node_type
=
Terms
,
node_id
=
pack
"0"
,
node_label
=
pack
"animal"
,
node_attributes
=
Attributes
{
clust_default
=
0
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
3
,
node_type
=
Terms
,
node_id
=
pack
"1"
,
node_label
=
pack
"bird"
,
node_attributes
=
Attributes
{
clust_default
=
0
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"2"
,
node_label
=
pack
"boy"
,
node_attributes
=
Attributes
{
clust_default
=
1
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"3"
,
node_label
=
pack
"dog"
,
node_attributes
=
Attributes
{
clust_default
=
0
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"4"
,
node_label
=
pack
"girl"
,
node_attributes
=
Attributes
{
clust_default
=
1
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
4
,
node_type
=
Terms
,
node_id
=
pack
"5"
,
node_label
=
pack
"human body"
,
node_attributes
=
Attributes
{
clust_default
=
1
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
3
,
node_type
=
Terms
,
node_id
=
pack
"6"
,
node_label
=
pack
"object"
,
node_attributes
=
Attributes
{
clust_default
=
2
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"7"
,
node_label
=
pack
"pen"
,
node_attributes
=
Attributes
{
clust_default
=
2
},
node_children
=
[]
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"8"
,
node_label
=
pack
"table"
,
node_attributes
=
Attributes
{
clust_default
=
2
},
node_children
=
[]
}],
_graph_edges
=
[
Edge
{
edge_source
=
pack
"0"
,
edge_target
=
pack
"0"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"0"
},
Edge
{
edge_source
=
pack
"1"
,
edge_target
=
pack
"0"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"1"
},
Edge
{
edge_source
=
pack
"1"
,
edge_target
=
pack
"1"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"2"
},
Edge
{
edge_source
=
pack
"2"
,
edge_target
=
pack
"2"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"3"
},
Edge
{
edge_source
=
pack
"2"
,
edge_target
=
pack
"5"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"4"
},
Edge
{
edge_source
=
pack
"3"
,
edge_target
=
pack
"0"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"5"
},
Edge
{
edge_source
=
pack
"3"
,
edge_target
=
pack
"1"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"6"
},
Edge
{
edge_source
=
pack
"3"
,
edge_target
=
pack
"3"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"7"
},
Edge
{
edge_source
=
pack
"4"
,
edge_target
=
pack
"4"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"8"
},
Edge
{
edge_source
=
pack
"4"
,
edge_target
=
pack
"5"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"9"
},
Edge
{
edge_source
=
pack
"5"
,
edge_target
=
pack
"5"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"10"
},
Edge
{
edge_source
=
pack
"6"
,
edge_target
=
pack
"6"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"11"
},
Edge
{
edge_source
=
pack
"7"
,
edge_target
=
pack
"6"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"12"
},
Edge
{
edge_source
=
pack
"7"
,
edge_target
=
pack
"7"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"13"
},
Edge
{
edge_source
=
pack
"8"
,
edge_target
=
pack
"6"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"14"
},
Edge
{
edge_source
=
pack
"8"
,
edge_target
=
pack
"7"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"15"
},
Edge
{
edge_source
=
pack
"8"
,
edge_target
=
pack
"8"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"16"
}],
_graph_metadata
=
Nothing
}
defaultGraph
=
Graph
{
_graph_nodes
=
[
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
4
,
node_type
=
Terms
,
node_id
=
pack
"0"
,
node_label
=
pack
"animal"
,
node_attributes
=
Attributes
{
clust_default
=
0
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
3
,
node_type
=
Terms
,
node_id
=
pack
"1"
,
node_label
=
pack
"bird"
,
node_attributes
=
Attributes
{
clust_default
=
0
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"2"
,
node_label
=
pack
"boy"
,
node_attributes
=
Attributes
{
clust_default
=
1
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"3"
,
node_label
=
pack
"dog"
,
node_attributes
=
Attributes
{
clust_default
=
0
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"4"
,
node_label
=
pack
"girl"
,
node_attributes
=
Attributes
{
clust_default
=
1
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
4
,
node_type
=
Terms
,
node_id
=
pack
"5"
,
node_label
=
pack
"human body"
,
node_attributes
=
Attributes
{
clust_default
=
1
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
3
,
node_type
=
Terms
,
node_id
=
pack
"6"
,
node_label
=
pack
"object"
,
node_attributes
=
Attributes
{
clust_default
=
2
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"7"
,
node_label
=
pack
"pen"
,
node_attributes
=
Attributes
{
clust_default
=
2
},
node_children
=
Nothing
},
Node
{
node_x_coord
=
0
,
node_y_coord
=
0
,
node_size
=
2
,
node_type
=
Terms
,
node_id
=
pack
"8"
,
node_label
=
pack
"table"
,
node_attributes
=
Attributes
{
clust_default
=
2
},
node_children
=
Nothing
}],
_graph_edges
=
[
Edge
{
edge_source
=
pack
"0"
,
edge_target
=
pack
"0"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"0"
},
Edge
{
edge_source
=
pack
"1"
,
edge_target
=
pack
"0"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"1"
},
Edge
{
edge_source
=
pack
"1"
,
edge_target
=
pack
"1"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"2"
},
Edge
{
edge_source
=
pack
"2"
,
edge_target
=
pack
"2"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"3"
},
Edge
{
edge_source
=
pack
"2"
,
edge_target
=
pack
"5"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"4"
},
Edge
{
edge_source
=
pack
"3"
,
edge_target
=
pack
"0"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"5"
},
Edge
{
edge_source
=
pack
"3"
,
edge_target
=
pack
"1"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"6"
},
Edge
{
edge_source
=
pack
"3"
,
edge_target
=
pack
"3"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"7"
},
Edge
{
edge_source
=
pack
"4"
,
edge_target
=
pack
"4"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"8"
},
Edge
{
edge_source
=
pack
"4"
,
edge_target
=
pack
"5"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"9"
},
Edge
{
edge_source
=
pack
"5"
,
edge_target
=
pack
"5"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"10"
},
Edge
{
edge_source
=
pack
"6"
,
edge_target
=
pack
"6"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"11"
},
Edge
{
edge_source
=
pack
"7"
,
edge_target
=
pack
"6"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"12"
},
Edge
{
edge_source
=
pack
"7"
,
edge_target
=
pack
"7"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"13"
},
Edge
{
edge_source
=
pack
"8"
,
edge_target
=
pack
"6"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"14"
},
Edge
{
edge_source
=
pack
"8"
,
edge_target
=
pack
"7"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"15"
},
Edge
{
edge_source
=
pack
"8"
,
edge_target
=
pack
"8"
,
edge_weight
=
1.0
,
edge_confluence
=
0.5
,
edge_id
=
pack
"16"
}],
_graph_metadata
=
Nothing
}
-----------------------------------------------------------
-----------------------------------------------------------
...
@@ -227,7 +227,7 @@ graphV3ToGraph (GraphV3 links nodes) = Graph { _graph_nodes = map nodeV32node no
...
@@ -227,7 +227,7 @@ graphV3ToGraph (GraphV3 links nodes) = Graph { _graph_nodes = map nodeV32node no
,
node_x_coord
=
0
,
node_x_coord
=
0
,
node_y_coord
=
0
,
node_y_coord
=
0
,
node_attributes
=
Attributes
cl'
,
node_attributes
=
Attributes
cl'
,
node_children
=
[]
}
,
node_children
=
Nothing
}
linkV32edge
::
Int
->
EdgeV3
->
Edge
linkV32edge
::
Int
->
EdgeV3
->
Edge
linkV32edge
n
(
EdgeV3
eo_s'
eo_t'
eo_w'
)
=
linkV32edge
n
(
EdgeV3
eo_s'
eo_t'
eo_w'
)
=
...
@@ -264,5 +264,5 @@ mergeGraphNgrams graph@(Graph { _graph_nodes }) (Just listNgrams) = set graph_no
...
@@ -264,5 +264,5 @@ mergeGraphNgrams graph@(Graph { _graph_nodes }) (Just listNgrams) = set graph_no
where
where
-- lookup (NgramsTerm node_label) in listNgrams, then fetch (NgramsRepoElement _nre_children)
-- lookup (NgramsTerm node_label) in listNgrams, then fetch (NgramsRepoElement _nre_children)
children'
=
case
(
lookup
(
NgramsTerm
node_label
)
listNgrams
)
of
children'
=
case
(
lookup
(
NgramsTerm
node_label
)
listNgrams
)
of
Nothing
->
[]
Nothing
->
Nothing
Just
(
NgramsRepoElement
{
_nre_children
})
->
unNgramsTerm
<$>
mSetToList
_nre_children
Just
(
NgramsRepoElement
{
_nre_children
})
->
Just
$
unNgramsTerm
<$>
mSetToList
_nre_children
src/Gargantext/Core/Viz/Graph/Tools.hs
View file @
d1a75af8
...
@@ -222,7 +222,7 @@ data2graph labels coocs bridge conf partitions = Graph { _graph_nodes = nodes
...
@@ -222,7 +222,7 @@ data2graph labels coocs bridge conf partitions = Graph { _graph_nodes = nodes
,
node_attributes
=
,
node_attributes
=
Attributes
{
clust_default
=
maybe
0
identity
Attributes
{
clust_default
=
maybe
0
identity
(
Map
.
lookup
n
community_id_by_node_id
)
}
(
Map
.
lookup
n
community_id_by_node_id
)
}
,
node_children
=
[]
}
,
node_children
=
Nothing
}
)
)
|
(
l
,
n
)
<-
labels
|
(
l
,
n
)
<-
labels
,
Set
.
member
n
$
Set
.
fromList
,
Set
.
member
n
$
Set
.
fromList
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
5a8e197b
·
Nov 22, 2021
mentioned in commit
5a8e197b
mentioned in commit 5a8e197bead2998cf203b9b51dfe57a38075bb3b
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