Is there any convenient way to find source vertex from the target vertex

I want to find source vertex from target vertex,I know two methods Currently :
1、reverse edge
2、start from all vertex, traverse to the receiver, then keep the particular vertex in the result set.

Is there an easier way ?such as restpp request using Built-in Endpoints? or ?
Looking forward to your reply.
Thanks.

@ackerman If I understand correctly, you are exploring “pathfinding”. I would suggest using the /shortestpath endpoint.
https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#post-shortestpath-graphname-shortest-path-search

Also checkout /allpaths endpoint. https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#post-allpaths-graphname-all-paths-search

Thank you for your reply. I mean that if i know target vertex, how could i find the source vertex?
/shortestpath endpoint need the information of source vertex, but my goal is to find the source vertex.

TigerGraph has an open source graph algorithm library. I would check out the section called “single source shortest path” that will start from one vertex and find all paths (in your case leading to your source vertex)

Docs:
https://docs.tigergraph.com/tigergraph-platform-overview/graph-algorithm-library

Repo:

Algo Code:

Let me have a try. Thanks for your help.

1 Like