GSQL grammar problem

  1. How to deal with the edge with the smallest weight that can be filtered from the accumulator of a storage edge?
  2. How to call another query repeatedly in one query?

The algorithm of all_pairs shortest path is used, but only one starting node can be input at runtime. How to input multiple starting nodes to reflect its multi-source characteristics?

  1. I don’t quite understand what you are asking.
    “deal with”: Do you want to find the edge with lowest weight, from some collection of edges? How is this collection of edges defined?
    “accumulator of a storage edge”: I don’t follow.

  2. You can put the call inside a loop (WHILE or FOREACH). I believe you can also have it in the ACCUM clause of SELECT statement.

The k_means algorithm in the Graph Data Science Library has an example with a FOREACH loop:

1 Like

Note that the All-Pairs Shortest Path GSQL code at All-Pairs Shortest Path :: TigerGraph Graph Data Science Library is an example, rather than an official part of the Graph Data Science Library.

This query’s input parameters do not include any individual vertices, only the vertex types.

CREATE QUERY tg_all_pairs_shortest( SET v_type_set, SET e_type_set,
STRING wt_attr, STRING wt_type, STRING result_attribute = “”, STRING file_path = “”)

1 Like