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
7f38878d
Commit
7f38878d
authored
Mar 31, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ILouvain/HyperGraph'] last fun before mvH
parent
7adf6636
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
13 deletions
+29
-13
ILouvain.hs
src/Data/Graph/Clustering/ILouvain.hs
+29
-13
No files found.
src/Data/Graph/Clustering/ILouvain.hs
View file @
7f38878d
...
@@ -166,6 +166,8 @@ class IsHyperGraph a where
...
@@ -166,6 +166,8 @@ class IsHyperGraph a where
imodularity_
::
a
->
a
->
[
Node
]
->
Double
imodularity_
::
a
->
a
->
[
Node
]
->
Double
gmodularity_
::
a
->
a
->
Double
gmodularity_
::
a
->
a
->
Double
hdeg_
::
a
->
Node
->
Maybe
Int
------------------------------------------------------------------------
------------------------------------------------------------------------
hnodes
::
HyperGraph
a
b
->
Node
->
[
Node
]
hnodes
::
HyperGraph
a
b
->
Node
->
[
Node
]
...
@@ -193,11 +195,6 @@ isFlat g = all (isEmpty . snd) (labNodes g)
...
@@ -193,11 +195,6 @@ isFlat g = all (isEmpty . snd) (labNodes g)
isFlat'
::
HyperGraph'
a
b
c
->
Bool
isFlat'
::
HyperGraph'
a
b
c
->
Bool
isFlat'
g
=
all
(
isFlat
.
snd
)
(
labNodes
g
)
isFlat'
g
=
all
(
isFlat
.
snd
)
(
labNodes
g
)
{-
hdeg :: Graph gr => gr a b -> Node -> Maybe Int
hdeg = undefined
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-- TODO go depth in HyperGraph (modularity at level/depth)
-- TODO go depth in HyperGraph (modularity at level/depth)
...
@@ -226,17 +223,14 @@ gmodularity' g g' = sum $ map (\n -> imodularity' g g' [n]) $ nodes g'
...
@@ -226,17 +223,14 @@ gmodularity' g g' = sum $ map (\n -> imodularity' g g' [n]) $ nodes g'
toHyperGraph
::
Gr
()
Double
->
HyperGraph
Double
Double
toHyperGraph
::
Gr
()
Double
->
HyperGraph
Double
Double
toHyperGraph
g
=
nmap
(
\
_
->
empty
)
g
toHyperGraph
g
=
nmap
(
\
_
->
empty
)
g
toHyperGraph'
::
Gr
()
Double
->
HyperGraph'
Double
Double
Double
toHyperGraph'
g
=
nmap
(
\
_
->
emptyHyperGraph
)
g
------------------------------------------------------------------------
emptyHyperGraph
::
HyperGraph
Double
Double
emptyHyperGraph
::
HyperGraph
Double
Double
emptyHyperGraph
=
toHyperGraph
empty
emptyHyperGraph
=
toHyperGraph
empty
emptyHyperGraph'
::
HyperGraph'
Double
Double
Double
emptyHyperGraph'
::
HyperGraph'
Double
Double
Double
emptyHyperGraph'
=
undefined
emptyHyperGraph'
=
toHyperGraph'
empty
{-
toHyperGraph' :: Gr () Double -> HyperGraph' Double Double Double
toHyperGraph' g = nmap (\_ -> emptyHyperGraph) g
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Spoon Graph
-- Spoon Graph
-- 1
-- 1
...
@@ -260,6 +254,20 @@ spoon = mkGraph ns es
...
@@ -260,6 +254,20 @@ spoon = mkGraph ns es
,
(
4
,
5
,
1.0
)
,
(
4
,
5
,
1.0
)
]
]
spoon'
::
HyperGraph'
Double
Double
Double
spoon'
=
mkGraph
ns
es
where
ns
::
[
LNode
(
HyperGraph
Double
Double
)]
ns
=
zip
[
1
..
6
]
(
cycle
[
emptyHyperGraph
])
es
::
[
LEdge
Double
]
es
=
[
(
1
,
2
,
1.0
)
,
(
1
,
3
,
1.0
)
,
(
2
,
4
,
1.0
)
,
(
3
,
4
,
1.0
)
,
(
4
,
5
,
1.0
)
]
-- | Needed function
-- | Needed function
-- mv: a Node elsewhere in the HyperGraph
-- mv: a Node elsewhere in the HyperGraph
...
@@ -275,6 +283,15 @@ spoon = mkGraph ns es
...
@@ -275,6 +283,15 @@ spoon = mkGraph ns es
-- Move target type
-- Move target type
-- let's start simple: path lenght <= 2 max
-- let's start simple: path lenght <= 2 max
mvH
::
Show
a
=>
HyperGraph'
a
a
a
->
[
Node
]
->
[
Node
]
->
HyperGraph'
a
a
a
mvH
=
undefined
mv
::
Show
a
=>
HyperGraph
a
a
mv
::
Show
a
=>
HyperGraph
a
a
->
[
Node
]
->
[
Node
]
->
[
Node
]
->
[
Node
]
->
HyperGraph
a
a
->
HyperGraph
a
a
...
@@ -327,7 +344,6 @@ merge = ufold (&)
...
@@ -327,7 +344,6 @@ merge = ufold (&)
------------------------------------------------------------------------
------------------------------------------------------------------------
test_mv
::
(
Ord
a
,
Show
a
)
=>
HyperGraph
a
a
->
Node
->
Node
->
Bool
test_mv
::
(
Ord
a
,
Show
a
)
=>
HyperGraph
a
a
->
Node
->
Node
->
Bool
test_mv
g
a
b
=
(
mv
(
mv
g
[
a
]
[
b
])
[
b
,
a
]
[]
)
==
g
test_mv
g
a
b
=
(
mv
(
mv
g
[
a
]
[
b
])
[
b
,
a
]
[]
)
==
g
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Paths in the Graph to be tested
-- Paths in the Graph to be tested
-- Directed graph strategy
-- Directed graph strategy
...
...
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