@@ -155,27 +155,34 @@ int LAGr_Modularity(
155155 GRB_TRY (GrB_reduce (vmask , NULL , NULL , GrB_LOR_MONOID_BOOL , C , NULL ));
156156 GRB_TRY (GrB_apply (vmask , vmask , NULL , GrB_LNOT , vmask , NULL ));
157157
158+ // FIXME:
159+ #if 1
160+
158161 // If any of the above vectors have fewer entries than nclusters, this means
159162 // that there are singleton clusters with one vertex/no out-degree/no
160163 // in-degree. So we need to add explicit zeros wherever values are missing
161164 // for further calculations.
162165 GrB_Index nclusters , nl , nk_out , nk_in ;
163166 GRB_TRY (GrB_Vector_nvals (& nclusters , vmask ));
167+
164168 GRB_TRY (GrB_Vector_nvals (& nl , l ));
165- GRB_TRY (GrB_Vector_nvals (& nk_out , l ));
166- GRB_TRY (GrB_Vector_nvals (& nk_in , l ));
169+ GRB_TRY (GrB_Vector_nvals (& nk_out , k_out /* l */ ));
170+ GRB_TRY (GrB_Vector_nvals (& nk_in , k_in /* l */ ));
167171
168172 if (nclusters != nl )
169173 {
174+ // printf ("l needs padding (%ld, %ld)\n", nclusters, nl) ;
170175 GRB_TRY (GrB_assign (l , l , NULL , vmask , GrB_ALL , nclusters , GrB_DESC_SC ));
171176 }
172177 if (nclusters != nk_out )
173178 {
179+ // printf ("k_out needs padding (%ld, %ld)\n", nclusters, nk_out) ;
174180 GRB_TRY (GrB_assign (k_out , k_out , NULL , vmask , GrB_ALL , nclusters ,
175181 GrB_DESC_SC ));
176182 }
177183 if (nclusters != nk_in )
178184 {
185+ // printf ("k_in needs padding (%ld, %ld)\n", nclusters, nk_in) ;
179186 GRB_TRY (GrB_assign (k_in , k_in , NULL , vmask , GrB_ALL , nclusters ,
180187 GrB_DESC_SC ));
181188 }
@@ -192,11 +199,11 @@ int LAGr_Modularity(
192199 GRB_TRY (GrB_Vector_extractTuples_INT64 (NULL , (int64_t * ) k_outX , & nclusters , k_out ));
193200 GRB_TRY (GrB_Vector_extractTuples_INT64 (NULL , (int64_t * ) k_inX , & nclusters , k_in ));
194201
195- GrB_Index m , out_degree_sum , in_degree_sum , L_c ;
202+ GrB_Index out_degree_sum ;
196203 GRB_TRY (GrB_reduce (& out_degree_sum , NULL , GrB_PLUS_MONOID_INT64 , out_degree ,
197204 NULL ));
198205
199- m = out_degree_sum ;
206+ double m = out_degree_sum ;
200207 double norm = 1.0 / (m * m );
201208
202209 // compute modularity
@@ -207,6 +214,7 @@ int LAGr_Modularity(
207214 mod += (1.0 * lX [c ] / nedges ) -
208215 (resolution * ((k_outX [c ] * k_inX [c ]) * norm ));
209216 }
217+ #endif
210218
211219 // TODO: return a GrB_Scalar??
212220 (* mod_handle ) = mod ;
0 commit comments