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
4abc2735
Commit
4abc2735
authored
Apr 22, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Bridgeness (suite)
parent
d584aed7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
Prelude.hs
src/Gargantext/Prelude.hs
+1
-5
Bridgeness.hs
src/Gargantext/Viz/Graph/Bridgeness.hs
+9
-7
No files found.
src/Gargantext/Prelude.hs
View file @
4abc2735
...
...
@@ -30,7 +30,6 @@ module Gargantext.Prelude
,
sortWith
,
module
Prelude
,
MonadBase
(
..
)
,
Map2
,
lookup2
)
where
...
...
@@ -72,10 +71,7 @@ import Prelude (Enum, Bounded, minBound, maxBound, putStrLn)
-- import Gargantext.Utils.Count
import
qualified
Data.List
as
L
hiding
(
head
,
sum
)
import
qualified
Control.Monad
as
M
import
Data.Map
(
Map
)
import
qualified
Data.Map
as
M
import
qualified
Data.Map
as
M
import
Data.Map.Strict
(
insertWith
)
import
qualified
Data.Vector
as
V
import
Safe
(
headMay
,
lastMay
,
initMay
,
tailMay
)
...
...
src/Gargantext/Viz/Graph/Bridgeness.hs
View file @
4abc2735
...
...
@@ -53,10 +53,10 @@ bridgeness b ns = DM.fromList
nodeId2comId
::
[
LouvainNode
]
->
Map
LouvainNodeId
CommunityId
nodeId2comId
ns
=
fromList
[
(
nId
,
cId
)
|
LouvainNode
nId
cId
<-
ns
]
nodeId2comId
ns
=
fromList
[(
nId
,
cId
)
|
LouvainNode
nId
cId
<-
ns
]
groupEdges
::
Map
LouvainNodeId
CommunityId
groupEdges
::
Map
LouvainNodeId
CommunityId
->
Map
(
LouvainNodeId
,
LouvainNodeId
)
Double
->
Map
(
CommunityId
,
CommunityId
)
[((
LouvainNodeId
,
LouvainNodeId
),
Double
)]
groupEdges
m
=
fromListWith
(
<>
)
...
...
@@ -73,14 +73,16 @@ groupEdges m = fromListWith (<>)
filterComs
::
Bridgeness
->
Map
(
CommunityId
,
CommunityId
)
[((
LouvainNodeId
,
LouvainNodeId
),
Double
)]
->
Map
(
CommunityId
,
CommunityId
)
[((
LouvainNodeId
,
LouvainNodeId
),
Double
)]
filterComs
b
m
=
mapWithKey
filter'
m
filterComs
_b
m
=
DM
.
filter
(
\
n
->
length
n
>
0
)
$
mapWithKey
filter'
m
where
filter'
(
c1
,
c2
)
a
|
c1
==
c2
=
a
|
otherwise
=
take
n
$
sortOn
(
Down
.
snd
)
a
where
n
=
round
$
100
*
b
*
a'
/
t
-- TODO use n here
|
otherwise
=
take
1
$
sortOn
(
Down
.
snd
)
a
where
_n
::
Int
_n
=
round
$
100
*
a'
/
t
a'
=
fromIntegral
$
length
a
t
::
Double
t
=
fromIntegral
$
length
$
concat
$
elems
m
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