Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clustering-louvain
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
gargantext
clustering-louvain
Commits
5993a1f3
Commit
5993a1f3
authored
Mar 30, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] iLouvain adapted to Gargantext workflow
parent
1c82ad80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
Louvain.hs
src/Data/Graph/Clustering/Louvain.hs
+21
-5
No files found.
src/Data/Graph/Clustering/Louvain.hs
View file @
5993a1f3
...
...
@@ -19,11 +19,15 @@ References:
module
Data.Graph.Clustering.Louvain
where
import
Data.Map.Strict
(
Map
)
import
Data.List
(
maximumBy
,
nub
,
intersect
,
foldl'
,
zipWith
,
concat
)
import
Data.Graph.Inductive
import
Data.Graph.Clustering.Louvain.Utils
(
LouvainNode
(
..
),
toFGraph
)
import
Data.Graph.Clustering.Louvain.Utils
(
LouvainNode
(
..
),
toFGraph
,
map2graph
)
import
Data.Graph.Clustering.FLouvain
(
louvainFirstStepIterate
,
initialCGr
)
import
Data.Graph.Clustering.Louvain.Types
(
Community
(
..
),
comNodes
)
import
qualified
Data.Graph.Clustering.ILouvain
as
I
------------------------------------------------------------------------
-- | Definitions
------------------------------------------------------------------------
...
...
@@ -33,6 +37,18 @@ type Community = [Node]
-- type Partition = [Community]
type
Reverse
=
Bool
------------------------------------------------------------------------
iLouvain
::
I
.
MaxIterations
->
I
.
MaxSize
->
Map
(
Node
,
Node
)
Double
->
[
LouvainNode
]
iLouvain
x
s
m
=
concat
$
toLouvainNode
$
I
.
toNodes
$
I
.
iLouvain
x
s
I
.
DfsNodes
g
where
g
=
I
.
toHyperGraph
$
map2graph
m
------------------------------------------------------------------------
flouvain
::
Int
->
Gr
()
Double
->
[[
Node
]]
flouvain
n
g
=
map
(
comNodes
.
snd
)
$
labNodes
g'
...
...
@@ -44,10 +60,10 @@ hLouvain :: (Eq b, DynGraph gr)
->
gr
a
b
->
[
LouvainNode
]
hLouvain
r
g
=
concat
$
toLouvainNode
(
bestpartition
r
g
)
where
toLouvainNode
::
[[
Node
]]
->
[[
LouvainNode
]]
toLouvainNode
ns
=
zipWith
(
\
cId
ns'
->
map
(
\
n
->
LouvainNode
n
cId
)
ns'
)
[
1
..
]
ns
toLouvainNode
::
[[
Node
]]
->
[[
LouvainNode
]]
toLouvainNode
ns
=
zipWith
(
\
cId
ns'
->
map
(
\
n
->
LouvainNode
n
cId
)
ns'
)
[
1
..
]
ns
------------------------------------------------------------------------
-- | Partitionning the graph
------------------------------------------------------------------------
...
...
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