Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Faster EdgePartition building
  • Loading branch information
ankurdave committed Apr 21, 2014
commit f84585c3f8a081c53a46345ac3aeb7aa464fb524
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.util.Sorting

import org.apache.spark.graphx._
import org.apache.spark.graphx.util.collection.PrimitiveKeyOpenHashMap
import org.apache.spark.util.collection.PrimitiveVector
import org.apache.spark.util.collection.{BitSet, OpenHashSet, PrimitiveVector}

private[graphx]
class EdgePartitionBuilder[@specialized(Long, Int, Double) ED: ClassTag, VD: ClassTag](
Expand Down Expand Up @@ -60,8 +60,11 @@ class EdgePartitionBuilder[@specialized(Long, Int, Double) ED: ClassTag, VD: Cla
}
}

val vertexIds = srcIds.iterator ++ dstIds.iterator
val vertexPartition = VertexPartition(vertexIds.map(vid => (vid, defaultVertexAttr)))
val vidsIter = srcIds.iterator ++ dstIds.iterator
val vertexIds = new OpenHashSet[VertexId]
vidsIter.foreach(vid => vertexIds.add(vid))
val vertexPartition = new VertexPartition(
vertexIds, new Array[VD](vertexIds.capacity), new BitSet(vertexIds.capacity))
new EdgePartition(srcIds, dstIds, data, index, vertexPartition)
}
}