2

I am trying to implement the shortest path functionality of graphx using java. This is possible to do in scala but for java, I have not been able to find detailed documentation/concrete examples on how to do this. It has also been mentioned in various places that there is no Java API for Graphx.

I have found the following link which shows the details of the ShortestPath.run method: http://spark.apache.org/docs/latest/api/java/org/apache/spark/graphx/lib/ShortestPaths.html

I am writing the method and description here to make the explanation better.

run(Graph<VD,ED> graph, scala.collection.Seq<Object> landmarks, scala.reflect.ClassTag<ED> evidence$1)

The method computes shortest paths to the given set of landmark vertices.

So for the run method, I have tried to create the graph using the following basic structure:

JavaRDD<Tuple2<Object, String>> vertices
JavaRDD<Edge<String>> edges
ClassTag Tag = scala.reflect.ClassTag$.MODULE$.apply("".class);
Graph<String,String> graph = Graph.apply(vertices.rdd(),
edges.rdd(), "", StorageLevel.MEMORY_ONLY(),StorageLevel.MEMORY_ONLY(),Tag, Tag);

I am not sure if this is the correct way or the correct syntax for the Graph and ClassTag parameters so feel free to correct it.

The remaining parameter for the run method which needs to be specified is the sequence of landmark vertices but I don't know how to specify/use it. Does this parameter require the ids of the vertices as a list or something else?

scala.collection.Seq<Object> landmarks

Can anyone offer a solution as to how the graphx shortest path can be implemented, especially in java?

Shahji1472
  • 21
  • 3

0 Answers0