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
2afa4fd0
Commit
2afa4fd0
authored
Mar 23, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[HyperGraph] Finally maybe the right type.
parent
ba86adac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
15 deletions
+28
-15
ILouvain.hs
src/Data/Graph/Clustering/ILouvain.hs
+28
-15
No files found.
src/Data/Graph/Clustering/ILouvain.hs
View file @
2afa4fd0
...
@@ -19,15 +19,15 @@ ILouvain: really inductive Graph
...
@@ -19,15 +19,15 @@ ILouvain: really inductive Graph
module
Data.Graph.Clustering.ILouvain
module
Data.Graph.Clustering.ILouvain
where
where
import
Data.Maybe
(
catMaybes
)
import
Data.List
(
zip
,
cycle
)
import
Data.List
(
zip
,
cycle
)
import
Protolude
hiding
(
empty
)
import
Protolude
hiding
(
empty
,
(
&
)
)
import
Data.Graph.Inductive
import
Data.Graph.Inductive
------------------------------------------------------------------------
------------------------------------------------------------------------
--
Recursive Graph
--
HyperGraph Definition
data
RGraph
=
Empty
|
Gr
RGraph
Double
type
HyperGraph
a
b
=
Gr
(
Gr
()
a
)
b
deriving
(
Show
,
Eq
)
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Spoon Graph
-- Spoon Graph
-- 1
-- 1
...
@@ -38,11 +38,11 @@ data RGraph = Empty | Gr RGraph Double
...
@@ -38,11 +38,11 @@ data RGraph = Empty | Gr RGraph Double
-- |
-- |
-- 5
-- 5
spoon
::
Gr
RGraph
Double
spoon
::
HyperGraph
Double
Double
spoon
=
mkGraph
ns
es
spoon
=
mkGraph
ns
es
where
where
ns
::
[
LNode
RGraph
]
ns
::
[
LNode
(
Gr
()
Double
)
]
ns
=
zip
[
1
..
6
]
(
cycle
[
E
mpty
])
ns
=
zip
[
1
..
6
]
(
cycle
[
e
mpty
])
es
::
[
LEdge
Double
]
es
::
[
LEdge
Double
]
es
=
[
(
1
,
2
,
1.0
)
es
=
[
(
1
,
2
,
1.0
)
...
@@ -51,6 +51,26 @@ spoon = mkGraph ns es
...
@@ -51,6 +51,26 @@ spoon = mkGraph ns es
,
(
3
,
4
,
1.0
)
,
(
3
,
4
,
1.0
)
,
(
4
,
5
,
1.0
)
,
(
4
,
5
,
1.0
)
]
]
-- | Work in progress:
mvNode
::
HyperGraph
a
a
->
Node
->
Node
->
HyperGraph
a
a
mvNode
g
n1
n2
=
buildGr
$
catMaybes
[
c1
,
c2
]
where
(
c1
,
g1
)
=
match
n1
g
(
c2
,
g2
)
=
match
n2
g1
------------------------------------------------------------------------
-- | Recursive Node of Graph
{-
rnodes :: RGraph -> [Node]
rnodes Empty = []
rnodes g = concat $ map (\(x1, x2) -> [x1] <> rnodes x2) $ labNodes g
rlabNodes :: Graph' a b -> [LNode a]
rlabNodes Empty' = []
rlabNodes g = labNodes g
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Paths in the Graph to be tested
-- Paths in the Graph to be tested
-- Directed graph strategy
-- Directed graph strategy
...
@@ -67,11 +87,4 @@ path g' = map sortNodes cs
...
@@ -67,11 +87,4 @@ path g' = map sortNodes cs
cs
=
components
g
cs
=
components
g
g
=
undir
g'
g
=
undir
g'
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
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