[Query] How to find all possible paths from a vertex?
See original GitHub issueHi, I have a short question. I’d like to find all the possible paths from a vertex.
For example, given a graph
val z = Graph(1~>2, 2->3, 2~>4, 3~>4, 5~>4)
How do you find out all the paths starting from 1 ~ n?
In this case, the dead end will be 4, so the algorithm must find
1~>2~>3~4 and 1~2~4
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Query to retrieve all paths traversable from a given vertex
Using this simple binary tree as a test graph g.addV('root').property('data',9).as('root'). addV('node').property('data',5).as('b').
Read more >Print all paths from a given source to a destination
The idea is to do Depth First Traversal of a given directed graph. · Start the DFS traversal from the source. · Keep...
Read more >get all the paths from a graph with a given criteria
Get all the path from root to leaves which has at least one of the vertex from a vertexList. g.V(1).repeat(out()).until(outE().count().
Read more >Get list of paths - Queries - TigerGraph
Yesterday I returned a path/list of vertices and edges by passing in a starting vertex (word) and doing a loop until we found...
Read more >Find All Simple Paths Between Two Vertices in a Graph
In order to avoid cycles, we must prevent any vertex from being visited more than once in the simple path. To do that,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Before dealing with efficiency and elegance, did you check for cycles? Also, you better bank on PathBuilder that is able to check for valid paths. Then you may want to go with something like
def getPathsFrom(start: z1.NodeT, paths: List[z1.PathBuilder]): List[z1.Path]
Nice, thanks for your feedback guys! I will try to make a PR by incorporating all your advice.