Gaffer icon indicating copy to clipboard operation
Gaffer copied to clipboard

Create GetShortestPath operation

Open p013570 opened this issue 7 years ago • 2 comments

The GetShortestPath should take a start and end vertex (should it be an EntitySeed or just the vertex value?)

It should be configured with a maximum number of hops.

It would be useful for users to be able to specify which edge groups they wanted to traverse along. Users may also want to apply filters to those edges, or filter based on Entities. It is best to follow a similar pattern to GetWalks, where users provide a list of GetElements operations relating to the types of edges they want to traverse along?

What do we mean by shortest? The fewest number of edges? Or perhaps we use some number property like count on each edge and we find the path that has the smallest total count? A nice way to solve this question would be to allow a Function to be provided that takes a list of edges and returns the score. This could be defaulted to a Function that simply returns the length of the list.

p013570 avatar Nov 07 '17 09:11 p013570

It's worth noting that a few approaches could be taken depending on the exact question being asked. Different algorithms are used depending on whether the edges are weighted or not, and whether those weights are nonnegative or not. From an implementation perspective, there is also the Graphframes library which provides a Shortest Path implementation - though the output would be a Graphframe object containing the result(s).

t616178 avatar Nov 08 '17 12:11 t616178

We should create a new module within the library module: graph-analytic-library. The GetShortestPath operation should go in there.

Within the spark module we will also need to add a new module: spark-graph-analytic-library. The GraphFrames GetShortestPathHandler should go in there.

The GetShortestPath operation should not have a dependency on Spark or GraphFrames, but allow an operation handler to implement it in anyway it wants to. This would cause the output type to be unpredictable. Perhaps in addition to GetShortestPath<O> we need GetShortestPathAsGraphFrame so users can be sure what the output type will be.

p013570 avatar Nov 23 '17 17:11 p013570