giraph-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Bishop <jbishop....@gmail.com>
Subject Re: Giraph : newbie questions
Date Sat, 21 Jul 2012 17:50:38 GMT
Found the answer to my own question and thought I would post it...

What I did was modify the HashPartitionerFactor as below. Hope this helps
someone else!


public class MyPartitionerFactory extends
HashPartitionerFactory<GraphVertexIndex, LongWritable, LongWritable,
GraphMessage> {
    class WorkerPartitioner extends HashWorkerPartitioner<GraphVertexIndex,
LongWritable, LongWritable, GraphMessage> {
        @Override
        public PartitionOwner getPartitionOwner(GraphVertexIndex vertexId) {
            return
partitionOwnerList.get(Math.abs(vertexId.getIndex().hashCode()) %
partitionOwnerList.size());   // Replace with your own partition function
        }
    }
    @Override
    public WorkerGraphPartitioner<GraphVertexIndex, LongWritable,
LongWritable, GraphMessage> createWorkerGraphPartitioner() {
        return new WorkerPartitioner();
    }
}

Mime
View raw message