Given a starting vertex, how to find all vertices which are reachable from the vertex?

The following is my current solution:

CREATE QUERY findConnVerteies(VERTEX<person> p) FOR GRAPH ldbc_snb syntax v2{
starter={p};
allConn=SELECT v FROM starter-((_>|<_)*)-:v;
print allConn;
}

This solution takes at least 1 second in the testing.
How to optimize it ? Are there any other better solutions?

It may be possible to make it run faster by converting to V1 SYNTAX, but that would be subject to testing.

Before we go there, how many vertices are returned by the query? If it is a very large number, then 1 second may not be a long time at all.

Similarly, what hardware are you running on? Is it tgcloud.io fee tier? Those are quite small machines. TG is very scalable, so using a machine with more CPU’s may also speed up the query.

Thanks for answering my question.

Here is some testing result:
2 verteies returned,costing 2.5s、
3 verties returned,costing 2.6s、
48 verties,costing 9s

I run this query on 8 cores、128G memory machine

Okay, that is very slow. Strangely slow.
Are you running the query in graph studio?

I run the query by Python requests.get()

Hi,
This is not a proper answer to your question, but let me suggest pyTigerGraph to you. It’s a feature rich Python wrapper over the REST API, it might make your TigerGraph work easier and faster.

Thanks for the information!