I have been working on giraph from last 10 days.I got the ideas how to install and execute the given examples in Giraph. But I want to design my own custom code,so i need some help of you.If anyone is done with this please let me know and give some idea.
Asked
Active
Viewed 811 times
1 Answers
2
What you need is to create a new project, a package foo and a class foo1 in that package. this project must reference to giraph-core jar files. class foo1 must extends class AbstractComputation. You should override compute function of AbstractComputation. In the compute function you will develop your own graph algorithm based on vertex-oriented paradigm.
For more information about how to implement your own algorithm, you can examples provided in giraph-examples package of giraph like SimpleConnectedComponents.java and SingleSourceShortestPaths.java.
After you implement foo1, you should create a jar file from your project and pass this jar file into your command using -libjars parameter.

Masoud Sagharichian
- 293
- 2
- 9
-
Thanks a lot for tour quick response.How to use -libjars in my command i am using hadoop jar /usr/local/giraph/giraph-examples/target/giraph-examples-1.2.0-SNAPSHOT-for-hadoop-2.7.0-jar-with-dependencies.jar org.apache.giraph.GiraphRunner org.apache.giraph.examples.SimpleShortestPathsComputation -vif org.apache.giraph.io.formats.JsonLongDoubleFloatDoubleVertexInputFormat -vip /tiny_graph.txt -vof org.apache.giraph.io.formats.IdWithValueTextOutputFormat -op /shortestpaths -w 1 -ca giraph.SplitMasterWorker=false For running it.can you provide me some sample code for it. – ldmi May 30 '15 at 06:53
-
hadoop jar /usr/local/giraph/giraph-examples/target/giraph-examples-1.2.0-SNAPSHOT-for-hadoop-2.7.0-jar-with-dependencies.jar org.apache.giraph.GiraphRunner -libjars [path-to-your-jar-file]/foo.jar foo.foo1 -vif org.apache.giraph.io.formats.JsonLongDoubleFloatDoubleVertexInputFormat -vip /tiny_graph.txt -vof org.apache.giraph.io.formats.IdWithValueTextOutputFormat -op /shortestpaths -w 1 -ca giraph.SplitMasterWorker=false – Masoud Sagharichian May 30 '15 at 07:16
-
Hi thanks...but when i try to do that its showing an error as Not a valid JAR: /usr/local/giraph/giraph-examples/target/giraph-examples-1.2.0-SNAPSHOT-for-hadoop-2.7.0-jar-with-dependencies.jar – ldmi Jun 01 '15 at 06:23
-
hadoop jar /usr/local/giraph/giraph-examples/target/giraph-examples-1.2.0-SNAPSHOT-for-hadoop-2.7.0-jar-with-dependencies.jar org.apache.giraph.GiraphRunner -libjars /home/GiraphCustom010615/example.jar giraphsample.MaxVal -vif org.apache.giraph.io.formats.JsonLongDoubleFloatDoubleVertexInputFormat -vip /tiny_graph.txt -vof org.apache.giraph.io.formats.IdWithValueTextOutputFormat -op /shortestpaths -w 1 -ca giraph.SplitMasterWorker=false here example.jar is my jar file and giraphsample is the package and class is MaxVal – ldmi Jun 01 '15 at 06:52
-
try this: hadoop jar /usr/local/giraph/giraph-examples/target/giraph-examples-1.2.0-SNAPSHOT-for-hadoop-2.7.0-jar-with-dependencies.jar org.apache.giraph.GiraphRunner -libjars /home/GiraphCustom010615/example.jar,/usr/local/giraph/giraph-examples/target/giraph-examples-1.2.0-SNAPSHOT-for-hadoop-2.7.0-jar-with-dependencies.jar giraphsample.MaxVal -vif org.apache.giraph.io.formats.JsonLongDoubleFloatDoubleVertexInputFormat -vip /tiny_graph.txt -vof org.apache.giraph.io.formats.IdWithValueTextOutputFormat -op /shortestpaths -w 1 -ca giraph.SplitMasterWorker=false here example.jar – Masoud Sagharichian Jun 01 '15 at 07:06
-
also append these two jar files into your HADOOP_CLASSPATH in hadoop-env.sh – Masoud Sagharichian Jun 01 '15 at 07:08
-
Thanx Masoud for your help...I did all configuration according to your input but still facing same issue.can you explain me if i want to run it in eclipse how to do it.how to write my configuration class i.e giraphRunner calss for a giraph code. – ldmi Jun 01 '15 at 12:11
-
Hi Guys Thanks a lot for cooperation .i solved the issue and i am also able to run it from eclipse. – ldmi Jun 03 '15 at 07:09