giraph-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Panagiotis Liakos <p.lia...@di.uoa.gr>
Subject how should I configure ByteArrayEdges<IntWritable, NullWritable>?
Date Mon, 07 Sep 2015 13:59:26 GMT
Hello all,

I am trying to create a ByteArrayEdges object for a given vertex. All
out-neighbors can be represented using Integers and there are no
weights in the graph so I am using Edge<IntWritable, NullWritable> to
populate my object.

Please see the following example:

@Test
public void error(){
   GiraphConfiguration giraphConfiguration = new GiraphConfiguration();
   giraphConfiguration.setComputationClass(TestComputation.class);
   giraphConfiguration.setOutEdgesClass(ByteArrayEdges.class);
   ImmutableClassesGiraphConfiguration immutableClassesGiraphConfiguration =
    new ImmutableClassesGiraphConfiguration(giraphConfiguration);
ByteArrayEdges<IntWritable, NullWritable> edges =
    (ByteArrayEdges<IntWritable, NullWritable>)
immutableClassesGiraphConfiguration.createOutEdges();
   List<Edge<IntWritable, NullWritable>> initialEdges = Lists.newArrayList(
       EdgeFactory.create(new IntWritable(1)),
       EdgeFactory.create(new IntWritable(2)));
edges.initialize((Iterable)initialEdges);
for(Iterator<Edge<IntWritable, NullWritable>> edgeIter =
edges.iterator(); edgeIter.hasNext();){
    edgeIter.next();
    }
}

This results in correctly building the object which dedicates 4 bytes
for each out-neighbor.
However, when iterating over the edges with a ByteArrayEdgeIterator I
receive an IllegalStateException. (java.lang.IllegalStateException:
next: Failed on pos 8 edge (targetVertexId = 8589934593, value = 0.0))

I inserted a printStackTrace() call and I get this error:
java.io.IOException: ensureRemaining: Only 0 bytes remaining, trying to read 8

Does anyone know how I am supposed to configure this so that the
iterator behaves normally?

--Panagiotis

Mime
View raw message