【发布时间】:2016-10-30 03:45:01
【问题描述】:
我是 spark 新手,我想加入两个 rdds 来制作邻接列表
RDD1 (nodes): (a, b, c, d, e, f, g)
RDD2 (Edges): ((a,b), (a,e), (f, a), (k,l) ...)
现在我想加入这两个rdds来创建一个这样的邻接列表
( (a,(b,e,..)), (b,(f,....), (g()) ,...)
#assuming that g is not connected to any node , also filter (k,l) because k and l are not in the nodes rdd
稍后我需要找到节点和边的总数。
【问题讨论】:
-
能否澄清一下:需要找到节点和边的总数?是不是说邻接表只是一个临时结构?
-
表示我需要计数和邻接表。
-
好的,你试过了吗?虽然 PySpark 中没有有效的解决方案,但这只是对内置方法的一次调用。
-
是的,我取得了一些进展。我现在有一个带有 (a ,(a,e),(a,b)..) 的 rdd 现在我想将其更改为 (a,(e,b,...)
标签: python apache-spark pyspark rdd