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
edfe388c
Commit
edfe388c
authored
Mar 25, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[HyperGraph] merge fun
parent
2e1077dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
FLouvain.hs
src/Data/Graph/Clustering/FLouvain.hs
+4
-2
ILouvain.hs
src/Data/Graph/Clustering/ILouvain.hs
+11
-8
No files found.
src/Data/Graph/Clustering/FLouvain.hs
View file @
edfe388c
...
...
@@ -196,7 +196,8 @@ delta com ki kiin m = DeltaQ $ acc - dec
-- We could avoid the higher complexity, eg. by precomputing the whole graph
-- into a HashMap Node [Edge].
iteration
::
FGraph
a
b
->
CGr
->
CGr
iteration
gr
cs
=
xdfsFoldWith
suc'
(
\
(
_
,
v
,
_
,
_
)
->
step
gw
$
context
gr
$
v
)
cs
(
nodes
gr
)
gr
iteration
gr
cs
=
xdfsFoldWith
suc'
(
\
(
_
,
v
,
_
,
_
)
->
step
gw
$
context
gr
$
v
)
cs
(
nodes
gr
)
gr
where
gw
=
graphWeight
gr
--weightSum = ufold weightSum' 0 gr
...
...
@@ -219,7 +220,8 @@ step gw ctx@(p, v, l, s) cgr = newCgr
else
cgr
(
bestFitCom
,
DeltaQ
bestFitdq
)
=
maximumBy
(
\
(
_
,
deltaq1
)
(
_
,
deltaq2
)
->
compare
deltaq1
deltaq2
)
deltas
(
bestFitCom
,
DeltaQ
bestFitdq
)
=
maximumBy
(
\
(
_
,
deltaq1
)
(
_
,
deltaq2
)
->
compare
deltaq1
deltaq2
)
deltas
mNc
::
Maybe
(
LNode
Community
)
mNc
=
nodeCommunity
v
cgr
...
...
src/Data/Graph/Clustering/ILouvain.hs
View file @
edfe388c
...
...
@@ -47,7 +47,6 @@ toSupra = undefined
-- 4
-- |
-- 5
spoon
::
HyperGraph
Double
Double
spoon
=
mkGraph
ns
es
where
...
...
@@ -80,14 +79,14 @@ spoon = mkGraph ns es
mv
::
HyperGraph
a
a
->
[
Node
]
->
[
Node
]
->
HyperGraph
a
a
mv
g
[
]
[]
=
g
mv
g
[
_
]
[
]
=
g
mv
g
[
]
[
_
]
=
g
mv
g
[
]
[ ]
=
g
mv
g
[
_
]
[
]
=
g
mv
g
[
]
[
_
]
=
g
mv
g
[
a
]
[
b
]
=
mv'
g
a
b
mv
g
[
a
,
b
]
[]
=
undefined
mv
g
[
a
]
[
b
]
=
mv'
g
a
b
mv
g
[
a
,
b
]
[
]
=
undefined
mv
g
(
x
:
xs
)
(
y
:
ys
)
=
panic
"mv path too long"
mv
g
(
x
:
xs
)
(
y
:
ys
)
=
panic
"mv
:
path too long"
-- | Start simple (without path)
mv'
::
HyperGraph
a
a
...
...
@@ -102,7 +101,7 @@ mvMContext :: Maybe (HyperContext a a)
->
Maybe
(
HyperContext
a
a
)
->
HyperContext
a
a
mvMContext
(
Just
(
a1
,
n
,
l
,
a2
))
(
Just
(
a1'
,
n'
,
l'
,
a2'
))
=
(
a1'
,
n'
,
c'
&
l
,
a2'
)
(
Just
(
a1'
,
n'
,
l'
,
a2'
))
=
(
a1'
,
n'
,
merge
l
(
c'
&
l'
)
,
a2'
)
where
c'
=
(
a1
,
n
,
()
,
a2
)
...
...
@@ -110,6 +109,10 @@ mvMContext _ (Just _) = panic "First Node does not exist"
mvMContext
(
Just
_
)
_
=
panic
"Snd Node does not exist"
mvMContext
_
_
=
panic
"Both Nodes do not exist"
merge
::
(
Graph
gr
,
DynGraph
gr
)
=>
gr
a
b
->
gr
a
b
->
gr
a
b
merge
=
ufold
(
&
)
------------------------------------------------------------------------
-- | Recursive Node of 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