Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
cdb02fb7
Commit
cdb02fb7
authored
Dec 04, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GRAPH] clean orphan nodes
parent
3eca5e5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
API.hs
src/Gargantext/Viz/Graph/API.hs
+1
-1
Tools.hs
src/Gargantext/Viz/Graph/Tools.hs
+11
-7
No files found.
src/Gargantext/Viz/Graph/API.hs
View file @
cdb02fb7
...
...
@@ -113,7 +113,7 @@ computeGraph cId nt v = do
graph
<-
liftIO
$
cooc2graph
0
myCooc
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
pure
graph'
pure
graph'
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
cdb02fb7
...
...
@@ -15,10 +15,10 @@ Portability : POSIX
module
Gargantext.Viz.Graph.Tools
where
--import Debug.Trace (trace)
import
Data.Graph.Clustering.Louvain.CplusPlus
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
)
import
Data.Map
(
Map
)
import
qualified
Data.Set
as
Set
import
Data.Text
(
Text
)
import
Gargantext.Prelude
import
Gargantext.Core.Statistics
...
...
@@ -43,7 +43,7 @@ cooc2graph :: Threshold
cooc2graph
threshold
myCooc
=
do
let
(
ti
,
_
)
=
createIndices
myCooc
myCooc'
=
toIndex
ti
myCooc
matCooc
=
map2mat
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
(
round
threshold
)
)
myCooc'
matCooc
=
map2mat
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
1
)
myCooc'
distanceMat
=
measureConditional
matCooc
distanceMap
=
Map
.
filter
(
>
threshold
)
$
mat2map
distanceMat
...
...
@@ -77,19 +77,23 @@ data2graph labels coocs bridge conf partitions = do
,
node_x_coord
=
0
,
node_y_coord
=
0
,
node_attributes
=
Attributes
{
clust_default
=
maybe
0
identity
Attributes
{
clust_default
=
maybe
0
identity
(
Map
.
lookup
n
community_id_by_node_id
)
}
}
)
|
(
l
,
n
)
<-
labels
,
Set
.
member
n
$
Set
.
fromList
$
List
.
concat
$
map
(
\
((
s
,
t
),
d
)
->
if
d
>
0
then
[
s
,
t
]
else
[]
)
$
Map
.
toList
bridge
]
let
edges
=
[
Edge
{
edge_source
=
cs
(
show
s
)
,
edge_target
=
cs
(
show
t
)
,
edge_weight
=
d
,
edge_confluence
=
maybe
0
identity
$
Map
.
lookup
(
s
,
t
)
conf
,
edge_target
=
cs
(
show
t
)
,
edge_weight
=
d
,
edge_confluence
=
maybe
0
identity
$
Map
.
lookup
(
s
,
t
)
conf
-- , edge_confluence = maybe (panic "E: data2graph edges") identity $ Map.lookup (s,t) conf
,
edge_id
=
cs
(
show
i
)
}
|
(
i
,
((
s
,
t
),
d
))
<-
zip
([
0
..
]
::
[
Integer
])
(
Map
.
toList
bridge
),
s
/=
t
,
d
>
0
.001
|
(
i
,
((
s
,
t
),
d
))
<-
zip
([
0
..
]
::
[
Integer
])
(
Map
.
toList
bridge
),
s
/=
t
,
d
>
0
]
pure
$
Graph
nodes
edges
Nothing
...
...
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