title: How to read values from a files as RDD[Long, List[Long] ] from a text file?
body: <p>I'm new to Scala and functional programming, and I'm trying read an undirected graph into Scala from a text file. The text  file is of the format:</p>
  
  <p>1,8,9,10
  2,5,6,7
  3,1,2</p>
  
  <p>which represents node 1 is connected to nodes 8,9 and 10(adjacency list), node 2 is connected to nodes 5,6 and 7 and so on.</p>
  
  <p>I am trying to read them as 
  RDD[1, <em>A list containing all the adjacenct nodes</em>]</p>
  
  <pre><code>var graphNodes = sc.textFile(*path to file*).map( line =&gt; { val a = line.split(",")
                                                                  ( a(0).toLong, a(1).toLong )  }  )
  </code></pre>
  
  <p>this would give me RDD[1,8]  as I read only the first adjacent value.</p>
  
  <p>Could anyone help me or provide me with some resources?</p>