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
27811443
Commit
27811443
authored
Mar 18, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cosmetics
parent
e4235d09
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
18 deletions
+27
-18
clustering-louvain.cabal
clustering-louvain.cabal
+2
-1
HLouvain.hs
src/Data/Graph/Clustering/HLouvain.hs
+25
-17
No files found.
clustering-louvain.cabal
View file @
27811443
...
...
@@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash:
92999c9be9048a97745703a9575dcb38cea579137bd2a893acf77c708290b84e
-- hash:
0eb2bbc80a3d9343540c4d5c0c2ff6adee085a9a75364b8f5344890891c5b781
name: clustering-louvain
version: 0.1.0.0
...
...
@@ -40,6 +40,7 @@ library
Data.Graph.Clustering.Louvain.CplusPlus
other-modules:
Data.Graph.Clustering.Example
Data.Graph.Clustering.FLouvain
Data.Graph.Clustering.HLouvain
Paths_clustering_louvain
default-language: Haskell2010
src/Data/Graph/Clustering/HLouvain.hs
View file @
27811443
...
...
@@ -7,14 +7,15 @@ Maintainer : alexandre.delanoe+louvain@iscpif.fr
Stability : experimental
Portability : POSIX
Clustering is not precise enought to work with (kmeans clustering is not
the same methodology than Louvain clustering fo rinstance).
Clustering is not precise enough to work with (kmeans clustering has not
the same methodology than Louvain clustering fo instance, not speaking
about the use of graph or not that is not the point).
Here is a new semantic to change this situation.
glustering vs klustering
glustering: agglomerate according to glue rules (bottom up)
klustering: split
in k parts
according to klue rules (top down)
klustering: split
according to klue rules (top down)
-}
...
...
@@ -65,8 +66,7 @@ comp g' = map sortNodes cs
where
sortNodes
ns
=
case
head
$
sortOn
(
Down
.
(
G
.
deg
g
))
ns
of
Nothing
->
[]
-- sort nodes by depth first to speed up the glustering
Just
n
->
G
.
dfs
[
n
]
g
Just
n
->
G
.
dfs
[
n
]
g
-- dfs for glustering, bfs for klustering
cs
=
G
.
components
g
g
=
G
.
undir
g'
...
...
@@ -78,7 +78,7 @@ comp g' = map sortNodes cs
-- are glusters with score of glue to build it.
data
Dendogram
=
Gram
Node
|
Dendogram
{
gluster
::
!
[
Dendogram
]
|
Dendogram
{
dends
::
!
[
Dendogram
]
-- d-ends ends can be either glusters or klusters
,
score
::
!
Double
}
deriving
(
Show
,
Eq
)
...
...
@@ -128,20 +128,28 @@ inDendo g d1@(Gram _) d2@(Gram _) = Dendogram n' (hasScore g n')
where
ds
=
inDendo
g
d1
(
toDendoD
g
d2
)
ss
=
hasScore
g
ds
n'
|
hasScore
g
d1
+
hasScore
g
d2
>
ss
=
[
d1
,
d2
]
|
otherwise
=
[
ds
]
inDendo
g
n
@
(
Gram
_
)
d
@
(
Dendogram
_
_
)
=
inDendo
g
(
toDendoD
g
n
)
d
s1
=
hasScore
g
d1
s2
=
hasScore
g
d2
n'
=
[
d1
,
d2
]
{-
n' | s1 + s2 > ss = [d1,d2]
| otherwise = [ds]
-}
inDendo
g
d
@
(
Dendogram
_
_
)
n
@
(
Gram
_
)
=
inDendo
g
n
d
inDendo
g
n
@
(
Gram
_
)
d
@
(
Dendogram
_
_
)
=
inDendo
g
(
toDendoD
g
n
)
d
inDendo
g
d1
@
(
Dendogram
_
_
)
d2
@
(
Dendogram
_
_
)
=
Dendogram
n'
(
hasScore
g
n'
)
inDendo
g
d1
@
(
Dendogram
_
s1
)
d2
@
(
Dendogram
_
s2
)
=
Dendogram
n'
(
hasScore
g
n'
)
where
ds
=
inDendo
g
d1
d2
ss
=
hasScore
g
ds
n'
|
hasScore
g
[
d1
,
d2
]
>
ss
=
[
d1
,
d2
]
n'
=
[
ds
]
{-
n' | s1 + s2 > ss = [d1,d2]
| otherwise = [ds]
-}
-------------------------------------------------------------------
nodesD
::
Dendogram
->
Set
Node
nodesD
(
Gram
n
)
=
Set
.
singleton
n
...
...
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