I have an array like that :
val pairs: Array[(Int, ((VertexId, Seq[Int]), Int))] 
which generates this output :
(11,((11,ArraySeq(2, 5, 4, 5)),1))
(11,((12,ArraySeq(7, 7, 8, 2)),1))
(11,((13,ArraySeq(5, 9, 8, 7)),1))
(1,((1,ArraySeq(1, 2, 3, 4)),1))
(1,((4,ArraySeq(1, 5, 1, 1)),1))
I want to build a Graph for each pairs._1. That means for example those who have the same id ( pairs._1 ) will construct a Graph together. 
I am thinking about passing a function of Graph Construction to every id.
How can I do that ?
                        
You're looking for the
groupByfunction followed bymapValuesto process each group.