@@ -206,27 +206,18 @@ GrB_Info init_vertices(GrB_Vector *users, GrB_Vector *cards)
206206}
207207
208208int banking_pagerank (
209+ // output
209210 GrB_Vector * centrality ,
210211 int * iters ,
212+ // input
213+ GrB_Vector subgraph ,
211214 const LAGraph_Graph G ,
212215 float tol ,
213216 int itermax )
214217{
215218 GrB_Vector r = NULL , t = NULL ;
216219 GrB_Matrix AT = NULL ;
217-
218- // ------------------------------------------------------------------------
219- // select adjacency matrix (use transpose if directed)
220- // ------------------------------------------------------------------------
221- if (G -> kind == LAGraph_ADJACENCY_UNDIRECTED ||
222- G -> is_symmetric_structure == LAGraph_TRUE )
223- {
224- AT = G -> A ;
225- }
226- else
227- {
228- AT = G -> AT ;
229- }
220+ AT = G -> AT ;
230221
231222 // ------------------------------------------------------------------------
232223 // initialization
@@ -238,7 +229,7 @@ int banking_pagerank(
238229 GrB_Vector_new (& r , GrB_FP64 , n );
239230
240231 double init = 1.0 / (double )n ;
241- GrB_assign (r , NULL , NULL , init , GrB_ALL , n , NULL );
232+ GrB_assign (r , subgraph , NULL , init , GrB_ALL , n , NULL );
242233
243234 double rdiff = 1.0 ;
244235
@@ -445,7 +436,7 @@ GrB_Info analyze_graph(GrB_Matrix tx_edge_mat, GrB_Matrix owns_edge_mat, GrB_Vec
445436
446437 TRY (LAGraph_Cached_OutDegree (G , msg ));
447438
448- TRY (banking_pagerank (& pagerank_ans , & iteraions , G , 1e-4 , 100 ));
439+ TRY (banking_pagerank (& pagerank_ans , & iteraions , EXPSUMvec , G , 1e-4 , 100 ));
449440 GxB_print (pagerank_ans , GxB_COMPLETE );
450441 GrB_free (& ID );
451442 GrB_free (& v );
0 commit comments