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
9027ce27
Commit
9027ce27
authored
Mar 24, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[HyperGraph] functions properties (mv).
parent
2bb0ebb2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
HLouvain.hs
src/Data/Graph/Clustering/HLouvain.hs
+3
-3
ILouvain.hs
src/Data/Graph/Clustering/ILouvain.hs
+41
-5
No files found.
src/Data/Graph/Clustering/HLouvain.hs
View file @
9027ce27
...
@@ -194,7 +194,7 @@ modularity gr ns = coverage - edgeDensity
...
@@ -194,7 +194,7 @@ modularity gr ns = coverage - edgeDensity
coverage
=
sizeSubGraph
/
sizeAllGraph
coverage
=
sizeSubGraph
/
sizeAllGraph
where
where
sizeSubGraph
::
Double
sizeSubGraph
::
Double
sizeSubGraph
=
fromIntegral
(
G
.
size
$
subgraph
ns
gr
)
sizeSubGraph
=
fromIntegral
(
G
.
size
$
subgraph
'
ns
gr
)
sizeAllGraph
::
Double
sizeAllGraph
::
Double
sizeAllGraph
=
fromIntegral
(
G
.
size
gr
)
sizeAllGraph
=
fromIntegral
(
G
.
size
gr
)
...
@@ -208,8 +208,8 @@ modularity gr ns = coverage - edgeDensity
...
@@ -208,8 +208,8 @@ modularity gr ns = coverage - edgeDensity
links
::
Double
links
::
Double
links
=
fromIntegral
(
2
*
(
G
.
size
gr
))
links
=
fromIntegral
(
2
*
(
G
.
size
gr
))
subgraph
::
DynGraph
gr
=>
Set
Node
->
gr
a
b
->
gr
a
b
subgraph
'
::
DynGraph
gr
=>
Set
Node
->
gr
a
b
->
gr
a
b
subgraph
ns
=
G
.
subgraph
(
Set
.
toList
ns
)
subgraph
'
ns
=
G
.
subgraph
(
Set
.
toList
ns
)
exclusion
::
Ord
a
=>
Set
a
->
Set
a
->
Set
a
exclusion
::
Ord
a
=>
Set
a
->
Set
a
->
Set
a
exclusion
a
b
=
(
Set
.\\
)
b
a
exclusion
a
b
=
(
Set
.\\
)
b
a
...
...
src/Data/Graph/Clustering/ILouvain.hs
View file @
9027ce27
...
@@ -27,7 +27,10 @@ import Data.Graph.Inductive
...
@@ -27,7 +27,10 @@ import Data.Graph.Inductive
------------------------------------------------------------------------
------------------------------------------------------------------------
-- HyperGraph Definition
-- HyperGraph Definition
type
HyperGraph
a
b
=
Gr
(
Gr
()
a
)
b
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)
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Spoon Graph
-- Spoon Graph
-- 1
-- 1
...
@@ -52,12 +55,45 @@ spoon = mkGraph ns es
...
@@ -52,12 +55,45 @@ spoon = mkGraph ns es
,
(
4
,
5
,
1.0
)
,
(
4
,
5
,
1.0
)
]
]
-- | Work in progress:
-- | Needed functions (WIP)
mvNode
::
HyperGraph
a
a
->
Node
->
Node
->
HyperGraph
a
a
-- mv: a Node elsewhere in the HyperGraph
mvNode
g
n1
n2
=
buildGr
$
catMaybes
[
c1
,
c2
]
-- Move Properties:
-- mv Node into another Node and remove it again should be equal to
-- identity
-- property test:
-- mv (mv g [a] [b]) [b,a] [] = identity
-- mv g [a] [] == g
-- mv g [a,b] [] /= g
-- mv (mv spoon [1] [4]) [4,1] [] = identity
-- Move target type
mv'
::
HyperGraph
a
a
->
[
Node
]
->
[
Node
]
->
HyperGraph
a
a
mv'
g
[]
[]
=
g
mv'
g
[
_
]
[]
=
g
mv'
g
(
x
:
xs
)
[]
=
undefined
-- | Start simple (without path)
mv
::
HyperGraph
a
a
->
Node
->
Node
->
HyperGraph
a
a
mv
g
n1
n2
=
delNode
n1
g
-- buildGr $ catMaybes [c1, c2]
where
where
(
c1
,
g1
)
=
match
n1
g
(
c1
,
g1
)
=
match
n1
g
(
c2
,
g2
)
=
match
n2
g1
{-
insertContext :: HyperContext a b
-> HyperContext a b
-> HyperContext a b
insertContext (a1,n,l,a2) (a1',n',l',a2') = (a1,n,l&l',a2)
--}
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Recursive Node of Graph
-- | 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