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
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
Christian Merten
haskell-gargantext
Commits
99f5ac3d
Commit
99f5ac3d
authored
Oct 14, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] another way to optimize
parent
d721d97d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Bridgeness.hs
src/Gargantext/Core/Viz/Graph/Bridgeness.hs
+11
-9
No files found.
src/Gargantext/Core/Viz/Graph/Bridgeness.hs
View file @
99f5ac3d
...
@@ -52,19 +52,21 @@ type Confluence = Map (NodeId, NodeId) Double
...
@@ -52,19 +52,21 @@ type Confluence = Map (NodeId, NodeId) Double
bridgeness3
::
Confluence
bridgeness3
::
Confluence
->
Map
(
NodeId
,
NodeId
)
Double
->
Map
(
NodeId
,
NodeId
)
Double
->
Map
(
NodeId
,
NodeId
)
Double
->
Map
(
NodeId
,
NodeId
)
Double
bridgeness3
c
m
=
Map
.
fromList
bridgeness3
c
m
=
trace
(
"bridgeness c' size: "
<>
(
show
$
List
.
length
c'
))
$
map
fst
$
Map
.
fromList
$
List
.
take
n
$
map
(
\
(
ks
,
(
v1
,
_v2
))
->
(
ks
,
v1
))
$
List
.
sortOn
(
Down
.
snd
)
$
List
.
take
n
$
catMaybes
-- $ List.sortOn (Down . (snd . snd))
$
map
(
\
(
ks
,
v
)
->
(,)
<$>
Just
(
ks
,
v
)
<*>
look
ks
c'
)
$
Map
.
toList
c'
$
Map
.
toList
m
where
where
!
c'
=
map2intMap
c
-- !c' = map2intMap c
!
c'
=
Map
.
intersectionWithKey
(
\
_k
v1
v2
->
(
v1
,
v2
))
m
c
!
m'
=
Map
.
toList
m
!
m'
=
Map
.
toList
m
n
::
Int
n
::
Int
!
n
=
trace
(
"bridgeness m size: "
<>
(
show
$
List
.
length
m'
))
$
round
$
(
fromIntegral
$
List
.
length
m'
)
/
(
10
::
Double
)
!
n
=
trace
(
"bridgeness m size: "
<>
(
show
$
List
.
length
m'
))
$
round
$
(
fromIntegral
$
List
.
length
m'
)
/
(
10
::
Double
)
map2intMap
::
Map
(
Int
,
Int
)
a
->
IntMap
(
IntMap
a
)
map2intMap
::
Map
(
Int
,
Int
)
a
->
IntMap
(
IntMap
a
)
...
...
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