@@ -674,10 +674,13 @@ def test_apply_node_move():
674
674
modularity of the new and old parititions"""
675
675
676
676
# nnod_mod, av_degrees, nmods
677
- networks = [ [3 , [2 ], [2 , 3 , 4 ]],
678
- [4 , [2 , 3 ], [2 , 4 , 6 ]],
677
+ #networks = [ [3, [2], [2, 3, 4]],
678
+ # [4, [2, 3], [2, 4, 6]],
679
+ # [8, [4, 6], [4, 6, 8]] ]
680
+ networks = [ [4 , [2 , 3 ], [2 , 4 , 6 ]],
679
681
[8 , [4 , 6 ], [4 , 6 , 8 ]] ]
680
682
683
+
681
684
for nnod_mod , av_degrees , nmods in networks :
682
685
for nmod in nmods :
683
686
nnod = nnod_mod * nmod
@@ -696,12 +699,16 @@ def test_apply_node_move():
696
699
#List of modules in the partition
697
700
r_mod = range (len (part_rand ))
698
701
702
+ #Make a graph_partition object
703
+ graph_partition = mod .GraphPartition (g ,part_rand )
704
+
699
705
#select two modules to change node assignments
700
706
mod_per = np .random .permutation (r_mod )
701
707
m1 = mod_per [0 ]; m2 = mod_per [1 ]
702
-
703
- #Make a graph_partition object
704
- graph_partition = mod .GraphPartition (g ,part_rand )
708
+ while len (graph_partition .index [m1 ]) <= 1 :
709
+ mod_per = np .random .permutation (r_mod )
710
+ m1 = mod_per [0 ]
711
+ m2 = mod_per [1 ]
705
712
706
713
#pick a random node to move between modules m1 and m2
707
714
node_list = list (graph_partition .index [m1 ])
0 commit comments