Re: Create a n x n graph given only the vertices no
Sorry.. Found the api.. On 21 Jan 2016 10:17, "praveen S" wrote: > Hi Robin, > > I am using Spark 1.3 and I am not able to find the api > Graph.fromEdgeTuples(edge RDD, 1) > > Regards, > Praveen > Well you can use a similar tech to generate an RDD[(Long, Long)] (that’s > what the edges variable is) and then create the Graph using > Graph.fromEdgeTuples. > > --- > Robin East > *Spark GraphX in Action* Michael Malak and Robin East > Manning Publications Co. > http://www.manning.com/books/spark-graphx-in-action > > > > > > On 11 Jan 2016, at 12:30, praveen S wrote: > > Yes I was looking something of that sort.. Thank you. > > Actually I was looking for a way to connect nodes based on the property of > the nodes.. I have a set of nodes and I know the condition on which I can > create an edge.. > On 11 Jan 2016 14:06, "Robin East" wrote: > >> Do you mean to create a perfect graph? You can do it like this: >> >> scala> import org.apache.spark.graphx._ >> import org.apache.spark.graphx._ >> >> scala> val vert = sc.parallelize(Seq(1L,2L,3L,4L,5L)) >> vert: org.apache.spark.rdd.RDD[Long] = ParallelCollectionRDD[23] at >> parallelize at :36 >> >> scala> val edges = vert.cartesian(vert) >> edges: org.apache.spark.rdd.RDD[(Long, Long)] = CartesianRDD[24] at >> cartesian at :38 >> >> scala> val g = Graph.fromEdgeTuples(edges, 1) >> >> >> That will give you a graph where all vertices connect to every other >> vertices. it will give you self joins as well i.e. vert 1 has an edge to >> vert 1, you can deal with this using a filter on the edges RDD if you don’t >> want self-joins >> >> -- >> Robin East >> *Spark GraphX in Action* Michael Malak and Robin East >> Manning Publications Co. >> http://www.manning.com/books/spark-graphx-in-action >> >> >> >> >> >> On 11 Jan 2016, at 03:19, praveen S wrote: >> >> Is it possible in graphx to create/generate graph of n x n given only the >> vertices. >> On 8 Jan 2016 23:57, "praveen S" wrote: >> >>> Is it possible in graphx to create/generate a graph n x n given n >>> vertices? >>> >> >> >
Re: Create a n x n graph given only the vertices no
Hi Robin, I am using Spark 1.3 and I am not able to find the api Graph.fromEdgeTuples(edge RDD, 1) Regards, Praveen Well you can use a similar tech to generate an RDD[(Long, Long)] (that’s what the edges variable is) and then create the Graph using Graph.fromEdgeTuples. --- Robin East *Spark GraphX in Action* Michael Malak and Robin East Manning Publications Co. http://www.manning.com/books/spark-graphx-in-action On 11 Jan 2016, at 12:30, praveen S wrote: Yes I was looking something of that sort.. Thank you. Actually I was looking for a way to connect nodes based on the property of the nodes.. I have a set of nodes and I know the condition on which I can create an edge.. On 11 Jan 2016 14:06, "Robin East" wrote: > Do you mean to create a perfect graph? You can do it like this: > > scala> import org.apache.spark.graphx._ > import org.apache.spark.graphx._ > > scala> val vert = sc.parallelize(Seq(1L,2L,3L,4L,5L)) > vert: org.apache.spark.rdd.RDD[Long] = ParallelCollectionRDD[23] at > parallelize at :36 > > scala> val edges = vert.cartesian(vert) > edges: org.apache.spark.rdd.RDD[(Long, Long)] = CartesianRDD[24] at > cartesian at :38 > > scala> val g = Graph.fromEdgeTuples(edges, 1) > > > That will give you a graph where all vertices connect to every other > vertices. it will give you self joins as well i.e. vert 1 has an edge to > vert 1, you can deal with this using a filter on the edges RDD if you don’t > want self-joins > > -- > Robin East > *Spark GraphX in Action* Michael Malak and Robin East > Manning Publications Co. > http://www.manning.com/books/spark-graphx-in-action > > > > > > On 11 Jan 2016, at 03:19, praveen S wrote: > > Is it possible in graphx to create/generate graph of n x n given only the > vertices. > On 8 Jan 2016 23:57, "praveen S" wrote: > >> Is it possible in graphx to create/generate a graph n x n given n >> vertices? >> > >
Re: Create a n x n graph given only the vertices no
Yes I was looking something of that sort.. Thank you. Actually I was looking for a way to connect nodes based on the property of the nodes.. I have a set of nodes and I know the condition on which I can create an edge.. On 11 Jan 2016 14:06, "Robin East" wrote: > Do you mean to create a perfect graph? You can do it like this: > > scala> import org.apache.spark.graphx._ > import org.apache.spark.graphx._ > > scala> val vert = sc.parallelize(Seq(1L,2L,3L,4L,5L)) > vert: org.apache.spark.rdd.RDD[Long] = ParallelCollectionRDD[23] at > parallelize at :36 > > scala> val edges = vert.cartesian(vert) > edges: org.apache.spark.rdd.RDD[(Long, Long)] = CartesianRDD[24] at > cartesian at :38 > > scala> val g = Graph.fromEdgeTuples(edges, 1) > > > That will give you a graph where all vertices connect to every other > vertices. it will give you self joins as well i.e. vert 1 has an edge to > vert 1, you can deal with this using a filter on the edges RDD if you don’t > want self-joins > > -- > Robin East > *Spark GraphX in Action* Michael Malak and Robin East > Manning Publications Co. > http://www.manning.com/books/spark-graphx-in-action > > > > > > On 11 Jan 2016, at 03:19, praveen S wrote: > > Is it possible in graphx to create/generate graph of n x n given only the > vertices. > On 8 Jan 2016 23:57, "praveen S" wrote: > >> Is it possible in graphx to create/generate a graph n x n given n >> vertices? >> > >
Re: Create a n x n graph given only the vertices no
you mean with out edges data? I dont think so. The other-way is possible..by calling fromEdges on Graph (this would assign vertices mentioned by edges default value ). please share your need/requirement in detail if possible.. On Sun, Jan 10, 2016 at 10:19 PM, praveen S wrote: > Is it possible in graphx to create/generate graph of n x n given only the > vertices. > On 8 Jan 2016 23:57, "praveen S" wrote: > >> Is it possible in graphx to create/generate a graph n x n given n >> vertices? >> >
Re: Create a n x n graph given only the vertices no
Is it possible in graphx to create/generate graph of n x n given only the vertices. On 8 Jan 2016 23:57, "praveen S" wrote: > Is it possible in graphx to create/generate a graph n x n given n > vertices? >