2

複数のサブグラフにフィルター処理したい親グラフがあるので、各サブグラフに関数を適用してデータを抽出できます。私のコードは次のようになります。

val myTerms = <RDD of terms I want to use to filter the graph>
val myVertices = ...
val myEdges = ...
val myGraph = Graph(myVertices, myEdges)

val myResults : RDD[(<Tuple>)] = myTerms.map { x => mySubgraphFunction(myGraph, x) }

mySubgraphFunction は、サブグラフを作成し、計算を実行し、結果データのタプルを返す関数です。

これを実行すると、mySubgraphFunction が GraphX.subgraph を呼び出す時点で Java ヌル ポインター例外が発生します。用語の RDD で collect を呼び出すと、これを機能させることができます (パフォーマンスのために RDD に永続化も追加されています)。

val myTerms = <RDD of terms I want to use to filter the graph>
val myVertices = <read RDD>.persist(StorageLevel.MEMORY_ONLY_SER)
val myEdges = <read RDD>.persist(StorageLevel.MEMORY_ONLY_SER)
val myGraph = Graph(myVertices, myEdges)

val myResults : Array[(<Tuple>)] = myTerms.collect().map { x =>
                 mySubgraphFunction(myGraph, x) }

collect() を呼び出す必要がない (つまり、これを分散操作にする) 方法はありますか? ~1k のサブグラフを作成していますが、パフォーマンスが低下しています。

4

0 に答える 0