@@ -124,9 +124,11 @@ int generic_spectral_test(vertex_t* h_src,
124
124
TEST_ASSERT (test_ret_value , ret_code == CUGRAPH_SUCCESS , "copy_to_host failed." );
125
125
126
126
for (int i = 0 ; (i < num_vertices ) && (test_ret_value == 0 ); ++ i ) {
127
+ //printf("\nh_result = %d, h_clusters = %d\n", h_result[h_vertices[i]], h_clusters[i]);
127
128
TEST_ASSERT (
128
129
test_ret_value , h_result [h_vertices [i ]] == h_clusters [i ], "cluster results don't match" );
129
130
}
131
+ //printf("\nmodularity = %f, expected_modularity = %f\n", modularity, expected_modularity);
130
132
131
133
TEST_ASSERT (test_ret_value ,
132
134
nearlyEqual (modularity , expected_modularity , 0.001 ),
@@ -255,9 +257,11 @@ int generic_balanced_cut_test(vertex_t* h_src,
255
257
TEST_ASSERT (test_ret_value , ret_code == CUGRAPH_SUCCESS , "copy_to_host failed." );
256
258
257
259
for (int i = 0 ; (i < num_vertices ) && (test_ret_value == 0 ); ++ i ) {
260
+ //printf("\nh_result = %d, h_clusters = %d\n", h_result[h_vertices[i]], h_clusters[i]);
258
261
TEST_ASSERT (
259
262
test_ret_value , h_result [h_vertices [i ]] == h_clusters [i ], "cluster results don't match" );
260
263
}
264
+ //printf("\nmodularity = %f, expected_modularity = %f\n", modularity, expected_modularity);
261
265
262
266
TEST_ASSERT (test_ret_value ,
263
267
nearlyEqual (modularity , expected_modularity , 0.001 ),
@@ -269,6 +273,7 @@ int generic_balanced_cut_test(vertex_t* h_src,
269
273
TEST_ASSERT (
270
274
test_ret_value , nearlyEqual (ratio_cut , expected_ratio_cut , 0.001 ), "ratio_cut doesn't match" );
271
275
276
+ //printf("\nedge_cut = %f, ratio_cut = %f\n", edge_cut, ratio_cut);
272
277
cugraph_clustering_result_free (result );
273
278
}
274
279
@@ -294,8 +299,9 @@ int test_spectral()
294
299
vertex_t h_dst [] = {1 , 2 , 0 , 2 , 0 , 1 , 3 , 2 , 4 , 5 , 3 , 5 , 3 , 4 };
295
300
weight_t h_wgt [] = {
296
301
0.1f , 0.2f , 0.1f , 1.2f , 0.2f , 1.2f , 2.3f , 2.3f , 3.4f , 3.5f , 3.4f , 4.5f , 3.5f , 4.5f };
297
- vertex_t h_result [] = {0 , 0 , 0 , 1 , 1 , 1 };
298
- weight_t expected_modularity = 0.136578 ;
302
+
303
+ vertex_t h_result [] = {0 , 0 , 0 , 0 , 1 , 1 };
304
+ weight_t expected_modularity = 0.044992 ;
299
305
weight_t expected_edge_cut = 0 ;
300
306
weight_t expected_ratio_cut = 0 ;
301
307
@@ -333,10 +339,10 @@ int test_balanced_cut_unequal_weight()
333
339
vertex_t h_dst [] = {1 , 2 , 0 , 2 , 0 , 1 , 3 , 2 , 4 , 5 , 3 , 5 , 3 , 4 };
334
340
weight_t h_wgt [] = {
335
341
0.1f , 0.2f , 0.1f , 1.2f , 0.2f , 1.2f , 2.3f , 2.3f , 3.4f , 3.5f , 3.4f , 4.5f , 3.5f , 4.5f };
336
- vertex_t h_result [] = {0 , 0 , 1 , 0 , 0 , 0 };
337
- weight_t expected_modularity = -0.02963 ;
338
- weight_t expected_edge_cut = 3.7 ;
339
- weight_t expected_ratio_cut = 4.44 ;
342
+ vertex_t h_result [] = {0 , 0 , 0 , 0 , 0 , 0 };
343
+ weight_t expected_modularity = 0 ;
344
+ weight_t expected_edge_cut = 0 ;
345
+ weight_t expected_ratio_cut = 0 ;
340
346
341
347
// balanced cut clustering wants store_transposed = FALSE
342
348
return generic_balanced_cut_test (h_src ,
@@ -371,10 +377,11 @@ int test_balanced_cut_equal_weight()
371
377
vertex_t h_src [] = {0 , 0 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 , 5 , 5 };
372
378
vertex_t h_dst [] = {1 , 2 , 0 , 2 , 0 , 1 , 3 , 2 , 4 , 5 , 3 , 5 , 3 , 4 };
373
379
weight_t h_wgt [] = {1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 };
374
- vertex_t h_result [] = {1 , 1 , 1 , 0 , 0 , 0 };
375
- weight_t expected_modularity = 0.357143 ;
376
- weight_t expected_edge_cut = 1 ;
377
- weight_t expected_ratio_cut = 0.666667 ;
380
+ //vertex_t h_result[] = {1, 1, 1, 0, 0, 0};
381
+ vertex_t h_result [] = {0 , 0 , 0 , 0 , 1 , 0 };
382
+ weight_t expected_modularity = -0.040816 ;
383
+ weight_t expected_edge_cut = 2 ;
384
+ weight_t expected_ratio_cut = 2.4 ;
378
385
379
386
// balanced cut clustering wants store_transposed = FALSE
380
387
return generic_balanced_cut_test (h_src ,
@@ -408,10 +415,10 @@ int test_balanced_cut_no_weight()
408
415
409
416
vertex_t h_src [] = {0 , 0 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 , 5 , 5 };
410
417
vertex_t h_dst [] = {1 , 2 , 0 , 2 , 0 , 1 , 3 , 2 , 4 , 5 , 3 , 5 , 3 , 4 };
411
- vertex_t h_result [] = {1 , 1 , 1 , 0 , 0 , 0 };
412
- weight_t expected_modularity = 0.357143 ;
413
- weight_t expected_edge_cut = 1 ;
414
- weight_t expected_ratio_cut = 0.666667 ;
418
+ vertex_t h_result [] = {0 , 0 , 0 , 0 , 1 , 0 };
419
+ weight_t expected_modularity = -0.040816 ;
420
+ weight_t expected_edge_cut = 2 ;
421
+ weight_t expected_ratio_cut = 2.4 ;
415
422
416
423
// balanced cut clustering wants store_transposed = FALSE
417
424
return generic_balanced_cut_test (h_src ,
0 commit comments