I have two arrays in Scala both with the same numbers
val v = myGraph.vertices.collect.map(_._1)
which gives:
Array[org.apache.spark.graphx.VertexId] = Array(-7023794695707475841, -44591218498176864, 757355101589630892, 21619280952332745)
and another
val w = myGraph.vertices.collect.map(_._2._2)
which gives:
Array[String] = Array(2, 3, 1, 2)
and i want to create a string using
val z = v.map("{id:" + _ + "," + "group:" + "1" + "}").mkString(",")
which gives:
String = {id:-7023794695707475841,group:1},{id:-44591218498176864,group:1},{id:757355101589630892,group:1},{id:21619280952332745,group:1}
But now instead of the hardcoded group of "1", i want to instead map in the numbers from the w array to give:
String = {id:-7023794695707475841,group:2},{id:-44591218498176864,group:3},{id:757355101589630892,group:1},{id:21619280952332745,group:2}
How do i do this?