In Scala, I have a an array of VertexIds
v: Array[org.apache.spark.graphx.VertexId] = Array(-2634311911308936962, 2326575714372975825, ...)
that i want to convert to a map where
Map(-2634311911308936962 -> 0,
2326575714372975825 -> 1,
...
)
What is the most efficient way of doing this?
v.zipWithIndex.toMap
won't be sorted though