Cannot pass vertex set as parameter to a subquery

Hello TigerGraph Team,

I modified pageRank into a subquery, which takes in a set of vertices (rather than vertex type, since I will run PageRank on a subgraph only), and add the PageRank score as attribute to each vertex.

Here is my code:

CREATE OR REPLACE QUERY pageRank (set<VERTEX> v_set, FLOAT max_change=0.001, INT max_iter=25, FLOAT damping=0.85, STRING result_attr = "wcc_pageRank_centrality") for graph cbit_sna returns (bool) {

MaxAccum @@max_diff = 9999;
SumAccum @recvd_score = 0;
SumAccum @score = 1;
Start = v_set;

WHILE @@max_diff > max_change LIMIT max_iter DO

  	@@max_diff = 0;

  	V = SELECT s
  		FROM Start:s -(SIMILAR_TO:e)- Car:t
  		ACCUM t.@recvd_score += s.@score/(s.outdegree("SIMILAR_TO")) 
  		POST-ACCUM s.@score = (1.0-damping) + damping * s.@recvd_score,
  				   s.@recvd_score = 0,
  				   @@max_diff += abs(s.@score - s.@score');

END;

V = SELECT s FROM Start:s
POST-ACCUM
s.setAttr(result_attr, s.@score);

return true;
}

But when I call it inside the main query like the following:

start = {Car.*};
flag = pageRank(start,_,_,_,_);

It gives me the error - Incompatible argument types for function/tuple pageRank

I wonder why it happens. Thanks!

Hi Yilun,

When running the query and supplying the parameters, instead of using the placeholder _, can you try typing out the other parameters?

I tried running your query in GraphStudio, and the editor was telling me that by using underscores, I was providing a vertex set. I am not sure why this is the case, but I was able to run the query once I typed out the other parameters instead of using the underscore.