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
15a3031c
Commit
15a3031c
authored
Mar 28, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[:)] almost
parent
94be2a54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
13 deletions
+46
-13
HLouvain.hs
src/Data/Graph/Clustering/HLouvain.hs
+4
-4
ILouvain.hs
src/Data/Graph/Clustering/ILouvain.hs
+42
-9
No files found.
src/Data/Graph/Clustering/HLouvain.hs
View file @
15a3031c
...
...
@@ -151,11 +151,11 @@ nodesD (Gram n) = Set.singleton n
nodesD
(
Dendogram
[]
_
)
=
Set
.
empty
nodesD
(
Dendogram
s
_
)
=
Set
.
unions
$
map
nodesD
s
deg
::
Graph
gr
=>
gr
a
b
->
Dendogram
->
Int
deg
g
d
=
Set
.
size
(
neighbors
g
d
)
h
deg
::
Graph
gr
=>
gr
a
b
->
Dendogram
->
Int
hdeg
g
d
=
Set
.
size
(
h
neighbors
g
d
)
neighbors
::
Graph
gr
=>
gr
a
b
->
Dendogram
->
Set
Node
neighbors
g
d
=
exclusion
inNodes
ouNodes
h
neighbors
::
Graph
gr
=>
gr
a
b
->
Dendogram
->
Set
Node
h
neighbors
g
d
=
exclusion
inNodes
ouNodes
where
inNodes
::
Set
Node
inNodes
=
nodesD
d
...
...
src/Data/Graph/Clustering/ILouvain.hs
View file @
15a3031c
...
...
@@ -8,7 +8,6 @@ Stability : experimental
Portability : POSIX
ILouvain: really inductive Graph
-}
module
Data.Graph.Clustering.ILouvain
...
...
@@ -25,25 +24,59 @@ import qualified Data.Graph.Clustering.HLouvain as H
-- HyperGraph Definition
type
HyperGraph
a
b
=
Gr
(
Gr
()
a
)
b
type
HyperContext
a
b
=
Context
(
Gr
()
a
)
b
-- TODO Later (hypothesis still)
-- type StreamGraph a b = Gr a (Gr () b)
{-
convergence :: HyperGraph a b -> HyperGraph a b
convergence g = if m - m' > 0.1 then g else g'
where
m = modularity g (hnodes g )
m' = modularity g' (hnodes g')
g' = step g
-}
steps
::
HyperGraph
a
a
->
[
Node
]
->
HyperGraph
a
a
steps
g
[ ]
=
g
steps
g
[
_
]
=
g
steps
g
ns
=
foldl'
(
\
g1
n
->
step'
g
g1
n
$
neighbors
g1
n
)
g
ns
step'
::
HyperGraph
a
b
->
HyperGraph
a
a
->
Node
->
[
Node
]
->
HyperGraph
a
a
step'
g
g'
n
ns
=
foldl'
(
\
g1
n'
->
step
g
g1
n
n'
)
g'
ns
step
::
HyperGraph
a
b
->
HyperGraph
a
a
->
Node
->
Node
->
HyperGraph
a
a
step
g
g'
n1
n2
=
if
s2
>
0
&&
s2
>
s1
then
mv
g'
[
n1
]
[
n2
]
else
g'
where
s1
=
imodularity
g
[
n1
]
s2
=
imodularity
g
[
n1
,
n2
]
------------------------------------------------------------------------
hnodes
::
HyperGraph
a
b
->
Node
->
[
Node
]
hnodes
g
n
=
case
match
n
g
of
(
Nothing
,
_
)
->
[]
(
Just
(
p
,
n
,
l
,
s
),
_
)
->
n
:
nodes
l
hedges
::
HyperGraph
a
b
->
Node
->
[
Edge
]
hedges
=
undefined
hneighbors
::
HyperGraph
a
b
->
Node
->
[
Node
]
hneighbors
=
undefined
hdeg
::
Graph
gr
=>
gr
a
b
->
Node
->
Maybe
Int
hdeg
=
undefined
------------------------------------------------------------------------
modularity
::
HyperGraph
a
b
->
[
Node
]
->
Double
modularity
g
ns
=
H
.
modularity
g
(
fromList
ns
)
-- TODO go depth in HyperGraph (modularity at level/depth)
imodularity
::
HyperGraph
a
b
->
[
Node
]
->
Double
imodularity
g
ns
=
H
.
modularity
g
(
fromList
ns
)
------------------------------------------------------------------------
-- Spoon 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