Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-igraph
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
haskell-igraph
Commits
86ddc5ed
Commit
86ddc5ed
authored
Feb 20, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spinglass corrected test (clustering)
parent
03c8885d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
Algorithms.hs
tests/Test/Algorithms.hs
+26
-4
No files found.
tests/Test/Algorithms.hs
View file @
86ddc5ed
...
...
@@ -144,16 +144,18 @@ bridgeTest = testCase "Bridges" $ edgeLab g <$> bridges g @?= ["bridge"]
communityTest
::
TestTree
communityTest
=
testGroup
"Community"
[
consistency
,
consistency2
,
consistency3
]
[
testGroup
"Consistency"
[
consistency
,
consistency2
,
consistency3
]
,
testGroup
"Correctness"
[
communityCorrectnessTests
]
]
where
consistency
=
testCase
"
Consistency
"
$
do
consistency
=
testCase
"
spinglass
"
$
do
rs
<-
replicateM
50
$
withSeed
134
$
findCommunity
zacharyKarate
Nothing
Nothing
spinglass
all
(
==
head
rs
)
rs
@=?
True
consistency2
=
testCase
"
Consistency --
leiden"
$
do
consistency2
=
testCase
"leiden"
$
do
rs
<-
replicateM
50
$
withSeed
234
$
findCommunity
zacharyKarate
Nothing
Nothing
leiden
True
@=?
all
(
==
head
rs
)
rs
consistency3
=
testCase
"
Consistency --
infomap"
$
do
consistency3
=
testCase
"infomap"
$
do
rs
<-
replicateM
50
$
withSeed
234
$
findCommunity
zacharyKarate
Nothing
Nothing
infomap
True
@=?
all
(
==
head
rs
)
rs
...
...
@@ -162,6 +164,26 @@ communityTest = testGroup "Community"
,
(
3
,
4
),
(
5
,
6
),
(
5
,
7
),
(
5
,
8
),
(
5
,
9
),
(
6
,
7
),
(
6
,
8
),
(
6
,
9
),
(
7
,
8
)
,
(
7
,
9
),
(
8
,
9
),
(
0
,
5
)
]
::
Graph
'U
()
()
communityCorrectnessTests
::
TestTree
communityCorrectnessTests
=
testGroup
"Clustering"
[
testCase
"spinglass"
spinglassClustering
]
where
spinglassClustering
::
Assertion
spinglassClustering
=
do
clusters
<-
withSeed
1
$
findCommunity
testGraph
Nothing
Nothing
spinglass
clusters
@?=
[[
3
,
4
],
[
0
,
1
,
2
]]
testGraph
::
Graph
'U
()
()
testGraph
=
mkGraphUfromEdges
[(
0
,
1
),(
1
,
2
),(
2
,
0
),(
2
,
3
),(
3
,
4
),(
4
,
2
)]
-- | Helper function to create an undirected graph from undirected edges.
mkGraphUfromEdges
::
[(
Int
,
Int
)]
->
Graph
'U
()
()
mkGraphUfromEdges
es
=
mkGraph
(
replicate
n
()
)
$
zip
es
$
repeat
()
where
(
a
,
b
)
=
unzip
es
n
=
length
(
nub
$
a
<>
b
)
pagerankTest
::
TestTree
pagerankTest
=
testGroup
"PageRank"
[
consistency
...
...
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