title: How to create a graph from a list with Spark Graphx
body: <p>I have a list in scala, like this:</p>
  
  <pre><code>  val log = List(
      List("a","b","c"),
      List("a","c","b","h","c"),
      List("a","d","e"),
      List("a","d","e","f","d","e")
    )
  </code></pre>
  
  <p>and i want to create a graph like this:</p>
  
  <p><a href="https://i.stack.imgur.com/ZfipQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZfipQ.png" alt="graph"></a>
  <br>
  with a method that create this two arrays:</p>
  
  <pre><code>  val vertexName: RDD[(VertexId, (String))] =
      sc.parallelize(Array((1L, ("a")), (2L, ("b")),
                           (3L, ("c")), (4L, ("d")),
                           (5L, ("e")), (6L, ("f")),
                           (7L, ("h"))))
  
    val edgeName: RDD[Edge[String]] =
      sc.parallelize(Array(Edge(1L, 2L, "1"), Edge(2L, 3L, "1"),
                           Edge(1L, 3L, "1"), Edge(3L, 2L, "1"),
                           Edge(2L, 7L, "1"), Edge(7L, 3L, "1"),
                           Edge(1L, 4L, "1"), Edge(4L, 5L, "1"),
                           Edge(5L, 6L, "1"), Edge(6L, 4L, "1")))
  
    val graph = Graph(vertexName, edgeName)
  </code></pre>
  
  <p>It's possible? There's a way?</p>