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.

@ackerman If I understand correctly, you are exploring “pathfinding”. I would suggest using the /shortestpath endpoint.

Also checkout /allpaths endpoint.

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)



Algo Code:

Let me have a try. Thanks for your help.

1 Like