objectEdgePartition2D extends PartitionStrategy with Product with Serializable
Assigns edges to partitions using a 2D partitioning of the sparse edge adjacency matrix,
guaranteeing a 2 * sqrt(numParts) bound on vertex replication.
Suppose we have a graph with 12 vertices that we want to partition
over 9 machines. We can use the following sparse matrix representation:
The edge denoted by E connects v11 with v1 and is assigned to processor P6. To get the
processor number we divide the matrix into sqrt(numParts) by sqrt(numParts) blocks. Notice
that edges adjacent to v11 can only be in the first column of blocks (P0, P3,
P6) or the last
row of blocks (P6, P7, P8). As a consequence we can guarantee that v11 will need to be
replicated to at most 2 * sqrt(numParts) machines.
Notice that P0 has many edges and as a consequence this partitioning would lead to poor work
balance. To improve balance we first multiply each vertex id by a large prime to shuffle the
vertex locations.
When the number of partitions requested is not a perfect square we use a slightly different
method where the last column can have a different number of rows than the others while still
maintaining the same size per block.
Assigns edges to partitions using a 2D partitioning of the sparse edge adjacency matrix, guaranteeing a
2 * sqrt(numParts)
bound on vertex replication.Suppose we have a graph with 12 vertices that we want to partition over 9 machines. We can use the following sparse matrix representation:
The edge denoted by
E
connectsv11
withv1
and is assigned to processorP6
. To get the processor number we divide the matrix intosqrt(numParts)
bysqrt(numParts)
blocks. Notice that edges adjacent tov11
can only be in the first column of blocks(P0, P3, P6)
or the last row of blocks(P6, P7, P8)
. As a consequence we can guarantee thatv11
will need to be replicated to at most2 * sqrt(numParts)
machines.Notice that
P0
has many edges and as a consequence this partitioning would lead to poor work balance. To improve balance we first multiply each vertex id by a large prime to shuffle the vertex locations.When the number of partitions requested is not a perfect square we use a slightly different method where the last column can have a different number of rows than the others while still maintaining the same size per block.