title: Storing Multiple Columns data in Edge and Vertices in Spark
body: <p>I am new to Spark Graphx and have dataframe for edges as:</p>
  <pre><code>Dataframe : edges_main
  +------------------+------------------+------------+--------+-----------+
  |               src|               dst|relationship|category|subcategory|
  +------------------+------------------+------------+--------+-----------+
  |294201130817328347|294201131015844283|   friend   |  school|      class|
  |294201131015844283|294201131007361339|  brother   |   home |     cousin|
  |294201131015844283|294201131014451003|  son       |   home |   relative|
  -------------------------------------------------------------------------
  
  </code></pre>
  <p>and vertices as:</p>
  <pre><code>Dataframe : vertices_main
  +------------------+----------+
  |               id |value|name|
  +------------------+----------+
  |294201130817328347|Mary |a   |
  |294201131015844283|Hola |b   |
  |294201131015844283|Rama |c   |
  -------------------------------
  
  </code></pre>
  <p>I want to preserve additional attributes in Graphx in so that I can access them with <code>map</code>. My code:</p>
  <pre><code>case class MyEdges(src: String, dst: String, attributes: MyEdgesLabel)
  case class MyEdgesLabel(relationship:String,category: String ,subcategory:String)
  
  val edges = edges_main.as[MyEdges].rdd.map { edge =&gt;
        Edge(
          edge.src.toLong,
          edge.dst.toLong,
          //**what to mention here(MyEdgesLabel)**//
        )}
  
  case class MyVerticesLabel(name:String)
  
  val vertices: RDD[(VertexId, Any)] = vertices_data.rdd.map(verticesRow =&gt; (
        verticesRow.getLong(0),
        verticesRow.getString(1))
  //**what to mention here(MyVerticesLabel)**//
      )
  </code></pre>
  <p>The reason of above requirement is the after creating graph, I can access additional attributes directly in following way:</p>
  <pre><code>val g = Graph(vertices, edges)
  g.vertices.map(v =&gt; v._1 + v._2 + /*addidtional attributes which is in case class MyEdgesLabel*/).collect.mkString 
  g.edges.map(e =&gt;  e.srcId + e.dstId + e.attr(/*addidtional attributes which is in case class 
   MyVerticesLabel*/))).collect.mkString
  </code></pre>
  <p>I got some clue from below url yet I'm still confused in catering multiple attributes in both vertices and edges:
  <a href="http://www.sunlab.org/teaching/cse6250/fall2019/spark/spark-graphx.html#graph-construction" rel="nofollow noreferrer">http://www.sunlab.org/teaching/cse6250/fall2019/spark/spark-graphx.html#graph-construction</a>.</p>
  <p>Kindly help regarding the same.</p>