In spark scala, I have a weighted graph of the following form :
- Edges: Edge(65281061,65281095,(8915415,229.81473441303393))
- Vertices: (65352257,(0.0,0.0,Map(254396716)))
The edges contains the distance (In this case; 229.81473441303393)
I want to calculate the shortest distance from sourceId = 4177086687 vertice to every other vertice in the graph.
I am running the following function:
ShortestPaths.run(weightedRoadGraph, Seq(sourceId))
and it returns me an integer as the distance (I assume it is the number of nodes).
+----------+------------------+
| _1| _2|
+----------+------------------+
| 65308287|{4177086687 -> 28}|
| 65310806|{4177086687 -> 38}|
| 65319968|{4177086687 -> 39}|
+----------+------------------+
I want to sum the distance from the edges and get a total sum distance. I want the output to be the total distance, rather than an integer.
Thanks in advance!