title: Forming Tuple for Graph Processing in Spark Scala
body: <p>I have the data as following</p>
  
  <pre><code>3,3,2
  4,1,3
  1,1,2
  1,3,0
  0,6,3
  2,2,3
  0,2,1
  0,5,2
  </code></pre>
  
  <p>I want to be able to build a tuple of the form</p>
  
  <pre><code>(2,Long.MAX_VALUE,((3,2)(1,1)(0,5))
  (3,Long.MAX_VALUE,((4,1)(0,6)(2,2))
  (0,Long.MAX_VALUE,((1,3))
  (1,Long.MAX_VALUE,((0,2))
  </code></pre>
  
  <p>I imported the data from a text file and used a mapper to form </p>
  
  <pre><code>(3,(2,3))
  (4,(3,1))
  </code></pre>
  
  <p>and so on</p>
  
  <p>I tried using a map to convert all these to the form</p>
  
  <pre><code>(0,Long.MAX_VALUE,(1,3)
  </code></pre>
  
  <p>and then i am using <code>groupBy(x =&gt; (x._1,x._2))</code> but am unable to form these tuples. What am i doing wrong</p>
  
  <p>i am getting tuples of the form</p>
  
  <p>(0,Long.MAX_VALUE,((0,Long.MAX_VALUE,1,3))</p>