Hello @tard_gabriel,
0 - What is the domain of your graph
We have a graph with data of many companies, and we are dealing with fraud prevention. To learn more about MAP Group; the company I'm working for, please visit:
LinkedIn: https://www.linkedin.com/company/mapg/
website: https://mapgroup.dk/
1 - What is the question I'm trying to solve
Finding multiple shortest paths. This includes all shortest paths, but also the next shortest paths, and maybe even the next shortest paths. This should be possible with any length, with max N hops, or if there are too many paths, then stop getting paths when a collection of paths with a size of M is reached. Where N and M could be any number.
The reason for this is because, we want to give a bigger overview than using just allShortestPaths, but not the complete overview, for finding every path with N hops from the start node, and then hopefully reach the endNode.
2 - Are you looking for only 2 specific nodes among all of them when you ask the question to your grah, or you are looking at all possible pair of nodes in your graph?
My solution are just parsing the start and end node. I don't really care if I get all possible node pairs, I only care about performance.
3 - For this or these pairs, do you have weight in your relationship?
No, the reason being that there is no need for weights in my case, all hops will be of weight=1.
4 - Can you define a bit more what you mean by weight?
I did not mention weights.
5 - Can we see your queries?
My solution is at this point just pseudo code, and I think it might contain too much private information to share. However, the result of the steps in the algorithm is shown in the picture of my solution.
To clarify the image for my solution:
using allShortestPaths, paths (in this case only looking at the relationships) that are found: [[1,5], [2,4]]
then excluding the 1 and 4 relationships by renaming their types to relName_TEMP.
then allShortestPaths again will find path: [2,3,5]
then restoring the type names of 1 and 4, and excluding the 2 and 5 relationships.
then allShortestPaths again will find path: [1,3,4]
relationships.
Then there is no more known relations therefore exclude all known relationships to this point (1,2,3,4,5).
then by using allShortestPaths again will reveal path: [6,7,8,9]
leaving the end result of (only looking at relationships) [[1,5], [2,4], [2,3,5], [1,3,4], [6,7,8,9]].
Then the algorithm is stopped since a desirable amount of paths is found. However, many more paths could be available in the much larger graph, and this is just the tiny snip of nodes+relationships that we know from the result of the allShortestPath algorithm.
I hope this helps to see the case and the problem, otherwise please don't hesitate to reach out again.
Best wishes,
Mathias Graabeck, Software engieneer @ MAP Group