Issues Regarding Jaccard Similarity Algorithm

Hi TigerGraph Team,

The Jaccard Similarity Algorithm needs (id, type) to specify a vertex type. If I just want the all vertices from vertex type Car, do I need to input all the related vertex ids? And what is the input format? A list of tuple such as [(id1, type), (id2, type), (id3, type), (id4, type), …] presumably ?

Thanks

The id is of the single vertex which you are comparing to. The type would be “Car”. So perhaps:

jaccard_nbor_ap_sub_file(10, "Car")

Hi rik,

Thanks for your timely reply.

Unfortunately it does not work, because the algorithm installed is jaccard_nbor_ap_sub_file(vertex source, int topK, file f) and the value 10 is for topK.

Also doesn’t the algorithm compare all vertex pairs of the the vertex type Car (as shown in the pic below)? So why do we need to specify vertex ids ?

OK. I think I understand. You need to install the correct routine i.e. jaccard_nbor_ap. Then that documentation is correct.

2 Likes

what is jaccard_nbor_ap_sub_file? Is this your own query or Tigergraph default jaccard_nbor_ap algorithm?

  1. The error message shows that you input the wrong argument. How to fix this depending on your query content about how to defined and use these arguments.
  2. According the doc, Tigergraph supports jaccard_nbor_ap algorithm. Try jaccard_nbor_ap(“Car”,10).
1 Like

Hi Ylhao,

I realized that jaccard_nbor_ap was not installed properly. The installation script created three queries:

  • jaccard_nbor_ap_file(int topK, file f),
  • jaccard_nbor_ap_sub(vertex source, int topK),
  • jaccard_nbor_ap_sub_file(vertex source, int topK, file f)

Jaccard_nbor_ap is not among them, since it could not be created for some reasons I did not understand. The error message is as follows:

Semantic Check Error in query jaccard_nbor_ap (SEM-1420): line 44, col 14
It is not supported in Json API Version “v2”. If you want to print attribute /
vertex-attached accumulator, please use the new grammar.
For example: “PRINT vSet [vSet.attr, vSet.@accum];”.
The query jaccard_nbor_ap cannot be added!

Thanks !

Hi rik,

I realized that jaccard_nbor_ap was not installed properly. The installation script created three queries:

  • jaccard_nbor_ap_file(int topK, file f),
  • jaccard_nbor_ap_sub(vertex source, int topK),
  • jaccard_nbor_ap_sub_file(vertex source, int topK, file f)

Jaccard_nbor_ap is not among them, since it could not be created for some reasons I did not understand. The error message is as follows:

Semantic Check Error in query jaccard_nbor_ap (SEM-1420): line 44, col 14
It is not supported in Json API Version “v2”. If you want to print attribute /
vertex-attached accumulator, please use the new grammar.
For example: “PRINT vSet [vSet.attr, vSet.@accum];”.
The query jaccard_nbor_ap cannot be added!

Thanks !

The newest gsql grammar is “v2”. What’s your Tigergraph version? If you use “v2” to create a query. It defined a new print style. As the error message shows: “PRINT vSet [vSet.attr, vSet.@accum];” is recommended.

My TigerGraph version is 3.1.0 (free version). Sadly, the installation script did not ask for anything regarding syntax version. It mainly asked for vertices and edges and then would automatically generate the jaccard_nbor_ap query.

How to generate the jaccard_nbor_ap query? May you tell me your steps?
Can you check the jaccard_nbor_ap query line 44? Just find the query and change the print style.

Since Jaccard Similarity Algorithm is a template algorithm, it needs to be installed prior to running.
Here is the detailed process https://docs.tigergraph.com/tigergraph-platform-overview/graph-algorithm-library#schema-free-algorithms.

But in short, I first ran the install.sh script and selected ‘jaccard_nbor_ap’ to install. The script then asked for the vertices and edges to run on Jaccard on.