@@ -142,26 +142,27 @@ def setUp(self):
142
142
graph , communities = get_test_data ()
143
143
self .graph = graph
144
144
self .communities = communities
145
+ self .louvain = wm .LouvainCommunityDetection (graph )
146
+ self .louvain_comm = wm .LouvainCommunityDetection (graph , communities )
145
147
146
148
def test_init (self ):
147
- louvain = wm . LouvainCommunityDetection ( self .graph )
149
+ louvain = self .louvain
148
150
self .assertEqual (louvain .graph , self .graph )
149
151
self .assertEqual (louvain .initial_communities , None )
150
152
self .assertEqual (louvain .minthr , 0.0000001 )
151
- """
152
153
153
- def test_communities_without_node():
154
- graph, communities = get_test_data()
155
- part = wm.WeightedPartition(graph) # one comm per node
156
- node = 0
157
- updated_comm = wm._communities_without_node(part, node )
158
- npt.assert_equal(updated_comm[0], set([]))
159
- part = wm.WeightedPartition(graph, communities)
160
- updated_comm = wm._communities_without_node(part, node )
161
- ## make sure we dont break communities from original partition
162
- npt.assert_equal(part.communities, communities)
163
- npt.assert_equal(0 not in updated_comm[0], True)
164
154
155
+ def test_communities_without_node (self ):
156
+ part = wm .WeightedPartition (self .graph ) # one comm per node
157
+ node = 0
158
+ updated_comm = self .louvain ._communities_without_node (part , node )
159
+ self .assertEqual (updated_comm [0 ], set ([]))
160
+ part = wm .WeightedPartition (self .graph , self .communities )
161
+ updated_comm = self .louvain_comm ._communities_without_node (part , node )
162
+ ## make sure we dont break communities from original partition
163
+ self .assertEqual (part .communities , self .communities )
164
+ self .assertEqual (0 not in updated_comm [0 ], True )
165
+ """
165
166
def test_communities_nodes_alledgesw():
166
167
graph, communities = get_test_data()
167
168
part = wm.WeightedPartition(graph, communities)
0 commit comments