giraph-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anna Xenaki <axen...@mail.ntua.gr>
Subject Re: giraph-netbeans -simple question
Date Mon, 25 May 2015 14:44:55 GMT
I have a few more questions...
1. When I run Junit do I have to run it in a pc with hadoop/Giraph 
installed? If so do I have to start hadoop before I ran the programm?
2.I made certain that nodes and edges are added correctly in the graph. 
But I get a null result after the job is run. And also I added 
System.out.println() in many places in my KatzReduce.java and nothing 
prints. As if it never got in to execute the job. *How can I fix this?**
*
public class KatzReduce extends BasicComputation<Text, FbGraphState, 
DoubleWritable, FbGraphMessage> {
....

if (getSuperstep() == 0) {
             sendMessageToAllEdges(vertex, new FbGraphMessage(0.5));
             vertex.voteToHalt();
             System.out.println("node "+vertex.getValue().getValue()+" 
got superstep 0");
             return;
         }
         if (getSuperstep() == 1) {
             double sum = 0;
             List<Text> mEdges = new ArrayList<>();
             for (FbGraphMessage message : messages) {
                 sum += message.getKatzWeight();
             }
vertex.getValue().setNodeWeight(vertex.getValue().getNodeWeight() + sum);
             sendMessageToAllEdges(vertex, new FbGraphMessage(0.25));
             vertex.voteToHalt();
               System.out.println("node "+vertex.getValue().getValue()+" 
got superstep 1");
             return;
         }
......
}

KatzReduceTest.java
public void testCompute() throws Exception {
     System.out.print("compute");
         String[] tinyGraph = 
{"1#2,3#54,78","2#1,3,4#78,63","3#1,2,4#77,125","4#2,3#77,63" };
         // This is where you configure your job
         GiraphConfiguration conf = new GiraphConfiguration();
         conf.setComputationClass(KatzReduce.class);
       //  conf.setMasterComputeClass();


         conf.setVertexInputFormatClass(FbGraphInputFormat.class);
conf.setVertexOutputFormatClass(FbGraphOutputFormat.class);
         // Run and print results
         Iterable<String> results = InternalVertexRunner.run(conf, 
tinyGraph, tinyGraph);
         for (String result : results) {
System.out.println(result);****<------result is always NULL 
------NullPointerException
                     assertEquals(result,"1");//will always fail cause I 
dont know the output format yet
         }
     }


output of node/edge list creation
compute1#2,3#54,78
added an edge id: 2 weight 1.0
added an edge id: 3 weight 1.0
created a vertex with value: 1 numOfedges: 2
2#1,3,4#78,63
added an edge id: 1 weight 1.0
added an edge id: 4 weight 1.0
added an edge id: 3 weight 1.0
created a vertex with value: 2 numOfedges: 3
3#1,2,4#77,125
added an edge id: 2 weight 1.0
added an edge id: 1 weight 1.0
added an edge id: 4 weight 1.0
created a vertex with value: 3 numOfedges: 3
4#2,3#77,63
added an edge id: 2 weight 1.0
added an edge id: 3 weight 1.0
created a vertex with value: 4 numOfedges: 2

Mime
View raw message