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
94be2a54
Commit
94be2a54
authored
Mar 27, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ILouvain] some functions (hnodes, modularity)
parent
a268fd35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
ILouvain.hs
src/Data/Graph/Clustering/ILouvain.hs
+19
-7
No files found.
src/Data/Graph/Clustering/ILouvain.hs
View file @
94be2a54
...
...
@@ -14,25 +14,37 @@ ILouvain: really inductive Graph
module
Data.Graph.Clustering.ILouvain
where
import
Data.Set
(
fromList
)
import
Data.Maybe
(
catMaybes
)
import
Data.List
(
zip
,
cycle
)
import
Protolude
hiding
(
empty
,
(
&
))
import
Data.Graph.Inductive
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)
toInfra
::
Gr
(
Gr
()
a
)
b
->
Gr
()
a
toInfra
=
undefined
toSupra
::
Gr
()
a
->
Gr
(
Gr
()
a
)
b
toSupra
=
undefined
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
------------------------------------------------------------------------
modularity
::
HyperGraph
a
b
->
[
Node
]
->
Double
modularity
g
ns
=
H
.
modularity
g
(
fromList
ns
)
-- TODO Later (hypothesis still)
-- type StreamGraph a b = Gr a (Gr () b)
------------------------------------------------------------------------
-- Spoon Graph
-- 1
...
...
@@ -79,7 +91,7 @@ mv g [_] [ ] = g
mv
g
[ ]
[
_
]
=
g
mv
g
[
a
]
[
b
]
=
case
a
==
b
of
True
->
panic
"mv
: same nodes, impossible mv
"
True
->
panic
"mv
, impossible: moved node is same as destination
"
False
->
mv'
g
a
b
mv
g
[
a
,
b
]
[ ]
=
case
match
a
g
of
(
Nothing
,
_
)
->
panic
"mv: fst Node of Path does not exist"
...
...
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