@@ -70,6 +70,7 @@ const matrix_info files [ ] =
7070//****************************************************************************
7171void test_msf (void )
7272{
73+ #if LG_SUITESPARSE_GRAPHBLAS_V10
7374 LAGraph_Init (msg ) ;
7475 bool burble = false ;
7576 GrB_Scalar zeroB = NULL ;
@@ -112,13 +113,18 @@ void test_msf (void)
112113 for (int jit = 0 ; jit <= 1 ; jit ++ )
113114 {
114115 if (jit ) printf ("\nJIT is enabled\n" ) ; else printf ("\nJIT is disabled\n" ) ;
116+
117+ // connected components
118+ GrB_Vector cc0 = NULL , cc1 = NULL , cc2 = NULL ;
119+
115120 OK (GxB_Global_Option_set (GxB_JIT_C_CONTROL ,
116121 jit ? GxB_JIT_ON : GxB_JIT_OFF )) ;
117122 // compute the min spanning forest
118123 C = NULL ;
119124 OK (LG_SET_BURBLE (burble )) ;
120- int result = LAGraph_msf (& C , A , sanitize , msg ) ;
125+ int result = LAGraph_msf (& C , & cc0 , A , sanitize , msg ) ;
121126 OK (LG_SET_BURBLE (false)) ;
127+
122128 printf ("result: %d\n" , result ) ;
123129 OK (result );
124130 GrB_Matrix_nvals (& branches , C );
@@ -133,22 +139,24 @@ void test_msf (void)
133139 OK (GrB_Matrix_eWiseAdd_BinaryOp (
134140 S , NULL , NULL , GxB_ANY_BOOL , S , S , GrB_DESC_T1 )) ;
135141 }
136- OK (GrB_Matrix_new (& S_C , GrB_BOOL , n , n )) ;
137- OK (GrB_Matrix_assign_BOOL (
138- S_C , C , NULL , (bool ) true, GrB_ALL , n , GrB_ALL , n , GrB_DESC_S )) ;
139- OK (GrB_Matrix_eWiseAdd_BinaryOp (
140- S_C , NULL , NULL , GxB_ANY_BOOL , S_C , S_C , GrB_DESC_T1 )) ;
141142 OK (LAGraph_New (& G , & S , LAGraph_ADJACENCY_UNDIRECTED , msg ));
142- OK (LAGraph_New (& G_C , & S_C , LAGraph_ADJACENCY_UNDIRECTED , msg ));
143-
144-
143+
145144 //Check that the graph has all the same ccs.
146- GrB_Vector cc0 = NULL , cc1 = NULL ;
147- OK (LAGr_ConnectedComponents (& cc0 , G , msg ));
148- OK (LAGr_ConnectedComponents (& cc1 , G_C , msg ));
145+ OK (LAGr_ConnectedComponents (& cc1 , G , msg )) ;
149146 bool ok = false ;
150- OK (LAGraph_Vector_IsEqual (& ok , cc0 , cc1 , msg ));
151- TEST_CHECK (ok );
147+ OK (GrB_Vector_new (& cc2 , GrB_UINT64 , n )) ;
148+ // cc1 and cc0 should have the same structure as cc2.
149+ // make their values equal and then compare them.
150+ // msf does not guarentee that the lower node is used as componentId
151+ OK (GxB_Vector_extract_Vector (cc2 , NULL , NULL , cc0 , cc1 , NULL )) ;
152+ OK (LAGraph_Vector_IsEqual (& ok , cc2 , cc0 , msg )) ;
153+
154+ // if(!ok)
155+ // {
156+ // GxB_print(cc2, GxB_SHORT);
157+ // GxB_print(cc0, GxB_SHORT);
158+ // }
159+ TEST_ASSERT (ok ) ;
152160 // check result C for A.mtx
153161 if (files [k ].ans_i && files [k ].ans_j )
154162 {
@@ -169,9 +177,9 @@ void test_msf (void)
169177 fabs (tot_weight - ans_w ) <= 1E-10 * fabs (ans_w )) ;
170178 OK (LAGraph_Matrix_Print (C , pr , stdout , msg )) ;
171179 OK (LAGraph_Delete (& G , msg )) ;
172- OK (LAGraph_Delete (& G_C , msg )) ;
173180 OK (GrB_free (& cc0 )) ;
174181 OK (GrB_free (& cc1 )) ;
182+ OK (GrB_free (& cc2 )) ;
175183 OK (GrB_free (& C )) ;
176184
177185 printf ("JIT test is done\n" ) ;
@@ -181,6 +189,7 @@ void test_msf (void)
181189 }
182190 GrB_free (& zeroB );
183191 LAGraph_Finalize (msg ) ;
192+ #endif
184193}
185194
186195//------------------------------------------------------------------------------
@@ -219,13 +228,13 @@ void test_inf_msf (void)
219228 // compute the min spanning forest
220229 S_C = C = NULL ;
221230 OK (LG_SET_BURBLE (burble )) ;
222- int result = LAGraph_msf (& C , A , false, msg ) ;
231+ int result = LAGraph_msf (& C , NULL , A , false, msg ) ;
223232 OK (LG_SET_BURBLE (false)) ;
224233 printf ("result: %d\n" , result ) ;
225234 OK (result );
226235
227236 OK (LG_SET_BURBLE (burble )) ;
228- result = LAGraph_msf (& S_C , S , false, msg ) ;
237+ result = LAGraph_msf (& S_C , NULL , S , false, msg ) ;
229238 OK (LG_SET_BURBLE (false)) ;
230239 printf ("result: %d\n" , result ) ;
231240 OK (result );
@@ -252,24 +261,24 @@ void test_errors (void)
252261
253262 #if LG_SUITESPARSE_GRAPHBLAS_V10
254263 // C and A are NULL
255- int result = LAGraph_msf (NULL , NULL , true, msg ) ;
264+ int result = LAGraph_msf (NULL , NULL , NULL , true, msg ) ;
256265 TEST_CHECK (result == GrB_NULL_POINTER ) ;
257266
258267 // A must be square
259268 OK (GrB_Matrix_new (& A , GrB_UINT64 , 3 , 4 )) ;
260- result = LAGraph_msf (& C , A , true, msg ) ;
269+ result = LAGraph_msf (& C , NULL , A , true, msg ) ;
261270 TEST_CHECK (result == GrB_DIMENSION_MISMATCH ) ;
262271 OK (GrB_free (& A )) ;
263272
264273 // A must real
265274 OK (GrB_Matrix_new (& A , GxB_FC32 , 4 , 4 )) ;
266- result = LAGraph_msf (& C , A , true, msg ) ;
275+ result = LAGraph_msf (& C , NULL , A , true, msg ) ;
267276 TEST_CHECK (result == GrB_DOMAIN_MISMATCH ) ;
268277
269278 #else
270279 // Not implemented
271280 OK (GrB_Matrix_new (& A , GrB_BOOL , 4 , 4 )) ;
272- int result = LAGraph_msf (& C , A , true, msg ) ;
281+ int result = LAGraph_msf (& C , NULL , A , true, msg ) ;
273282 TEST_CHECK (result == GrB_NOT_IMPLEMENTED ) ;
274283 #endif
275284
0 commit comments