Hi Neha,

Let us assume that you are using some partition tool which gives output in
the following format


Now you need to write code for few classes to get the job done

# Create a vertex class which implements writable interface and can store
vertex id and partition id

public class MyVertex implements WritableComparable {

private short partition;
private long id;

public MyVertex() {
//  get the partition from tokens[1] and the id from tokens[0] in the
constructor by specifying the delimeter
public MyVertex(String id) {
String[] tokens = id.split(DELIMITER);
this.partition = Short.parseShort(tokens[1]);
this.id = Long.parseLong(tokens[0]);
// you have to override the rest of the methods
specify this class by -vif option while submitting the application

# Implement GraphPartitionerFactory<I, V, E> such that it will invoke your
custom worker partitioner
public WorkerGraphPartitioner<I, V, E> createWorkerGraphPartitioner() {
return new MyWorkerPartitioner<I, V, E>();

specify this class  in -ca giraph.graphPartitionerFactoryClass while
submitting application

#Provide implementation for the workerPartitioner something like this

public class MyWorkerPartitioner<I extends WritableComparable, V extends
Writable, E extends Writable>
extends HashWorkerPartitioner<I, V, E> {

public PartitionOwner getPartitionOwner(I vertexId) {
             //write logic such that this method returns the desired
partition id.
Hope this helps!

On Tue, Jul 10, 2018 at 6:53 PM Neha Raj <[EMAIL PROTECTED]> wrote: