@@ -215,7 +215,7 @@ skip_if_no_python <- function() {
215215 testthat :: skip(" leidenalg not available for testing" )
216216}
217217
218-
218+ set.seed( 9000 )
219219test_that(" run with CPMVertexPartition multiplexed" , {
220220 skip_if_no_python()
221221 partition <- leiden(multiplex_graph ,
@@ -227,11 +227,12 @@ test_that("run with CPMVertexPartition multiplexed", {
227227 expect_equal(partition ,
228228 c(8 , 2 , 7 , 5 , 2 , 5 , 1 , 2 , 6 , 5 , 5 , 2 , 2 , 5 , 5 , 5 , 3 , 6 , 1 , 2 ,
229229 7 , 10 , 3 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2 , 4 , 4 , 2 ,
230- 2 , 2 , 6 , 4 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 6 , 7 , 6 , 4 , 9 , 4
230+ 2 , 2 , 6 , 4 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 3 , 7 , 6 , 4 , 9 , 4
231231 ))
232232 multiplex_graph
233233})
234234
235+ set.seed(9000 )
235236test_that(" run with ModularityVertexPartition multiplexed" , {
236237 skip_if_no_python()
237238 partition <- leiden(multiplex_graph ,
@@ -241,12 +242,17 @@ test_that("run with ModularityVertexPartition multiplexed", {
241242 seed = 9001 )
242243 expect_length(partition , length(V(multiplex_graph [[1 ]])))
243244 expect_equal(sort(unique(partition )), 1 : 6 )
245+ expect_equal(table(partition ),
246+ structure(c(`1` = 15L , `2` = 13L , `3` = 13L , `4` = 11L , `5` = 8L ,
247+ `6` = 1L ), .Dim = 6L , .Dimnames = list (partition = c(" 1" , " 2" ,
248+ " 3" , " 4" , " 5" , " 6" )), class = " table" ))
244249 expect_equal(partition ,
245- c(3 , 3 , 1 , 4 , 3 , 4 , 4 , 3 , 1 , 4 , 4 , 3 , 3 , 4 , 4 , 4 , 1 , 1 , 2 , 3 ,
246- 1 , 3 , 1 , 2 , 1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 5 , 5 , 3 , 3 ,
247- 3 , 1 , 5 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 5 , 5 , 5 , 1 , 1 , 1 , 5 , 6 , 5 ))
250+ c(4 , 2 , 4 , 4 , 2 , 4 , 4 , 2 , 1 , 4 , 4 , 2 , 2 , 4 , 4 , 4 , 1 , 1 , 3 , 2 ,
251+ 2 , 2 , 1 , 3 , 1 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 2 , 5 , 5 , 2 , 2 ,
252+ 2 , 1 , 5 , 2 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 5 , 5 , 5 , 1 , 4 , 1 , 5 , 6 , 5 ))
248253})
249254
255+ set.seed(9000 )
250256test_that(" run with ModularityVertexPartition multiplexed and max_comm_size" , {
251257 skip_if_no_python()
252258 partition <- leiden(multiplex_graph ,
@@ -258,8 +264,9 @@ test_that("run with ModularityVertexPartition multiplexed and max_comm_size", {
258264 expect_length(partition , length(V(multiplex_graph [[1 ]])))
259265 expect_equal(sort(unique(partition )), 1 : 10 )
260266 expect_equal(max(table(partition )), 8 )
261- expect_equal(partition ,
262- c(4 , 4 , 2 , 3 , 8 , 3 , 3 , 4 , 2 , 3 , 3 , 8 , 8 , 3 , 3 , 3 , 6 , 6 , 5 , 8 ,
263- 2 , 8 , 6 , 7 , 2 , 5 , 5 , 5 , 7 , 5 , 7 , 7 , 5 , 5 , 7 , 5 , 4 , 1 , 1 , 4 , 4 ,
264- 4 , 2 , 1 , 4 , 6 , 6 , 6 , 6 , 9 , 2 , 6 , 1 , 1 , 1 , 2 , 2 , 7 , 1 , 10 , 1 ))
267+ expect_equal(table(partition ),
268+ structure(c(`1` = 8L , `2` = 8L , `3` = 8L , `4` = 8L , `5` = 8L ,
269+ `6` = 8L , `7` = 6L , `8` = 5L , `9` = 1L , `10` = 1L ), .Dim = 10L , .Dimnames = list (
270+ partition = c(" 1" , " 2" , " 3" , " 4" , " 5" , " 6" , " 7" , " 8" , " 9" ,
271+ " 10" )), class = " table" ))
265272})
0 commit comments