Skip to content

Graph path finding algorithms #48

Answered by zh217
shivarajmulimani asked this question in Q&A
Discussion options

You must be logged in to vote

For 1, you just have to invert your relationships, and then the destination becomes the starting node. Then you can use the usual algorithms.

2 is more complicated. Basically, the algorithm can give you the path, and you need to use your host language to chop the path into path segments, and query the database again to find out the types. Then you can add this information back to the path you extracted. So two trips to the database are required. If you are worried about data inconsistency due to some other processes mutating the database while you run your queries, you can use multi-statement transaction.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shivarajmulimani
Comment options

Answer selected by shivarajmulimani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants