Unsubscribe
Best Regards, Mostafa Alaa Mohamed, Technical Expert Big Data, M: +971506450787 Email: mohamedamost...@etisalat.ae -----Original Message----- From: balaji9058 [mailto:kssb...@gmail.com] Sent: Wednesday, December 14, 2016 08:32 AM To: user@spark.apache.org Subject: Re: Graphx triplet comparison Hi Thanks for reply. Here is my code: class BusStopNode(val name: String,val mode:String,val maxpasengers :Int) extends Serializable case class busstop(override val name: String,override val mode:String,val shelterId: String, override val maxpasengers :Int) extends BusStopNode(name,mode,maxpasengers) with Serializable case class busNodeDetails(override val name: String,override val mode:String,val srcId: Int,val destId :Int,val arrivalTime :Int,override val maxpasengers :Int) extends BusStopNode(name,mode,maxpasengers) with Serializable case class routeDetails(override val name: String,override val mode:String,val srcId: Int,val destId :Int,override val maxpasengers :Int) extends BusStopNode(name,mode,maxpasengers) with Serializable val busstopRDD: RDD[(VertexId, BusStopNode)] = sc.textFile("\\BusStopNameMini.txt").filter(!_.startsWith("#")). map { line => val row = line split "," (row(0).toInt, new busstop(row(0),row(3),row(1)+row(0),row(2).toInt)) } busstopRDD.foreach(println) val busNodeDetailsRdd: RDD[(VertexId, BusStopNode)] = sc.textFile("\\RouteDetails.txt").filter(!_.startsWith("#")). map { line => val row = line split "," (row(0).toInt, new busNodeDetails(row(0),row(4),row(1).toInt,row(2).toInt,row(3).toInt,0)) } busNodeDetailsRdd.foreach(println) val detailedStats: RDD[Edge[BusStopNode]] = sc.textFile("\\routesEdgeNew.txt"). filter(! _.startsWith("#")). map {line => val row = line split ',' Edge(row(0).toInt, row(1).toInt,new BusStopNode(row(2), row(3),1) )} val busGraph = busstopRDD ++ busNodeDetailsRdd busGraph.foreach(println) val mainGraph = Graph(busGraph, detailedStats) mainGraph.triplets.foreach(println) val subGraph = mainGraph subgraph (epred = _.srcAttr.name == "101") //Working Fine for (subTriplet <- subGraph.triplets) { println(subTriplet.dstAttr.name) } //Working fine for (mainTriplet <- mainGraph.triplets) { println(subTriplet.dstAttr.name) } //causing error while iterating both at same time for (subTriplet <- subGraph.triplets) { for (mainTriplet <- mainGraph.triplets) { //Nullpointer exception is causing here if (subTriplet.dstAttr.name.toString.equals(mainTriplet.dstAttr.name)) { println("hellooooo")//success case on both destination names of of subgraph and maingraph } } } } BusStopNameMini.txt 101,bs,10,B 102,bs,10,B 103,bs,20,B 104,bs,14,B 105,bs,8,B RouteDetails.txt #101,102,104 4 5 6 #102,103 3 4 #103,105,104 2 3 4 #104,102,101 4 5 6 #104,101 5 #105,104,102 5 6 2 1,101,104,5,R 2,102,103,5,R 3,103,104,5,R 4,102,103,5,R 5,104,101,5,R 6,105,102,5,R routesEdgeNew.txt it contains two types of edges are bus to bus with edge value is distance and bus to route with edge value as time #101,102,104 4 5 6 #102,103 3 4 #103,105,104 2 3 4 #104,102,101 4 5 6 #104,101 5 #105,104,102 5 6 2 101,102,4,BS 102,104,5,BS 102,103,3,BS 103,105,4,BS 105,104,3,BS 104,102,4,BS 102,101,5,BS 104,101,5,BS 105,104,5,BS 104,102,6,BS 101,1,4,R,102 101,1,4,R,103 102,2,5,R 103,3,6,R 103,3,5,R 104,4,7,R 105,5,4,Z 101,2,9,R 105,5,4,R 105,2,5,R 104,2,5,R 103,1,4,R 101,103,4,BS 101,104,4,BS 101,105,4,BS 101,103,5,BS 101,104,5,BS 101,105,5,BS 1,101,4,R -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Graphx-triplet-comparison-tp28198p28205.html Sent from the Apache Spark User List mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe e-mail: user-unsubscr...@spark.apache.org ________________________________ The content of this email together with any attachments, statements and opinions expressed herein contains information that is private and confidential are intended for the named addressee(s) only. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. If you have received this message in error please notify postmas...@etisalat.ae by email immediately and delete the message without making any copies. --------------------------------------------------------------------- To unsubscribe e-mail: user-unsubscr...@spark.apache.org