@@ -47,21 +47,23 @@ GrB_Index *I = NULL, *V = NULL, *F = NULL, *B = NULL, *M = NULL;
4747// hold. The converse is not true unless F[u]==B[u]. However, we can safely remove
4848// an edge (u, v) if either F[u]!=F[v] or B[u]!=B[v] holds, which can accelerate
4949// the SCC computation in the future rounds.
50- bool edge_removal (GrB_Index i , GrB_Index j , const void * x , const void * thunk ) ;
51- bool edge_removal (GrB_Index i , GrB_Index j , const void * x , const void * thunk )
50+
51+ void edge_removal (bool * z , const void * x , GrB_Index i , GrB_Index j , const void * thunk ) ;
52+ void edge_removal (bool * z , const void * x , GrB_Index i , GrB_Index j , const void * thunk )
5253{
53- return !M [i ] && !M [j ] && F [i ] == F [j ] && B [i ] == B [j ];
54+ ( * z ) = ( !M [i ] && !M [j ] && F [i ] == F [j ] && B [i ] == B [j ]) ;
5455}
5556
5657//****************************************************************************
5758// trim_one: remove the edges connected to trivial SCCs
5859// - A vertex is a trivial SCC if it has no incoming or outgoing edges.
5960// - M[i] = i | if vertex i is a trivial SCC
6061// M[i] = n | otherwise
61- bool trim_one (GrB_Index i , GrB_Index j , const void * x , const void * thunk ) ;
62- bool trim_one (GrB_Index i , GrB_Index j , const void * x , const void * thunk )
62+
63+ void trim_one (bool * z , const void * x , GrB_Index i , GrB_Index j , const void * thunk ) ;
64+ void trim_one (bool * z , const void * x , GrB_Index i , GrB_Index j , const void * thunk )
6365{
64- return M [i ] == M [j ];
66+ ( * z ) = ( M [i ] == M [j ]) ;
6567}
6668
6769//****************************************************************************
@@ -123,7 +125,7 @@ int LAGraph_scc
123125 GrB_Vector ind ;
124126 GrB_Vector inf ;
125127 GrB_Vector f , b , mask ;
126- GxB_SelectOp sel1 , sel2 ;
128+ GrB_IndexUnaryOp sel1 = NULL , sel2 = NULL ;
127129 GrB_Monoid Add ;
128130
129131 if (result == NULL || A == NULL ) return (GrB_NULL_POINTER ) ;
@@ -169,9 +171,8 @@ int LAGraph_scc
169171 GRB_TRY (GrB_Vector_new (& f , GrB_UINT64 , n ));
170172 GRB_TRY (GrB_Vector_new (& b , GrB_UINT64 , n ));
171173 GRB_TRY (GrB_Vector_new (& mask , GrB_UINT64 , n ));
172- // GxB_SelectOp
173- GRB_TRY (GxB_SelectOp_new (& sel1 , trim_one , GrB_BOOL , GrB_NULL ));
174- GRB_TRY (GxB_SelectOp_new (& sel2 , edge_removal , GrB_BOOL , GrB_NULL ));
174+ GRB_TRY (GrB_IndexUnaryOp_new (& sel1 , (void * ) trim_one , GrB_BOOL , GrB_UINT64 , GrB_UINT64 ));
175+ GRB_TRY (GrB_IndexUnaryOp_new (& sel2 , (void * ) edge_removal , GrB_BOOL , GrB_UINT64 , GrB_UINT64 ));
175176
176177 // remove trivial SCCs
177178 GRB_TRY (GrB_reduce (f , 0 , GrB_PLUS_UINT64 , GrB_PLUS_UINT64 , FW , 0 ));
@@ -186,8 +187,8 @@ int LAGraph_scc
186187 if (nvals < n )
187188 {
188189 GRB_TRY (GrB_Vector_extractTuples (I , M , & n , scc ));
189- GRB_TRY (GxB_select (FW , 0 , 0 , sel1 , FW , GrB_NULL , 0 ));
190- GRB_TRY (GxB_select (BW , 0 , 0 , sel1 , BW , GrB_NULL , 0 ));
190+ GRB_TRY (GrB_select (FW , 0 , 0 , sel1 , FW , 0 , 0 ));
191+ GRB_TRY (GrB_select (BW , 0 , 0 , sel1 , BW , 0 , 0 ));
191192 }
192193
193194 GRB_TRY (GrB_Matrix_nvals (& nvals , FW ));
@@ -209,8 +210,8 @@ int LAGraph_scc
209210 GRB_TRY (GrB_Vector_extractTuples (I , B , & n , b ));
210211 GRB_TRY (GrB_Vector_extractTuples (I , M , & n , mask ));
211212
212- GRB_TRY (GxB_select (FW , 0 , 0 , sel2 , FW , GrB_NULL , 0 ));
213- GRB_TRY (GxB_select (BW , 0 , 0 , sel2 , BW , GrB_NULL , 0 ));
213+ GRB_TRY (GrB_select (FW , 0 , 0 , sel2 , FW , 0 , 0 ));
214+ GRB_TRY (GrB_select (BW , 0 , 0 , sel2 , BW , 0 , 0 ));
214215
215216 GRB_TRY (GrB_Matrix_nvals (& nvals , FW ));
216217 }
0 commit comments