question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Query] How to find all possible paths from a vertex?

See original GitHub issue

Hi, 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
peter-empencommented, Oct 12, 2018

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]

0reactions
JasonShincommented, Oct 12, 2018

Nice, thanks for your feedback guys! I will try to make a PR by incorporating all your advice.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found