Hi,

I decided to use LongDoubleFloatDoubleVertex in a graph algorithm because it uses more compact and efficient mahout collections. However I run into an error when running the algorithm:

java.lang.ClassCastException: org.apache.giraph.graph.LongDoubleFloatDoubleVertex cannot be cast to org.apache.giraph.graph.Vertex
at org.apache.giraph.comm.BasicRPCCommunications.prepareSuperstep(BasicRPCCommunications.java:1016)
at org.apache.giraph.graph.BspServiceWorker.startSuperstep(BspServiceWorker.java:843)
at org.apache.giraph.graph.GraphMapper.map(GraphMapper.java:569)
at org.apache.giraph.graph.GraphMapper.run(GraphMapper.java:728)
... 7 more


Basically, the problem is that in BasicRPCCommunications.prepareSuperStep(), the LongDoubleFloatDoubleVertex are cast to Vertex in the following code fragment. But LongDoubleFloatDoubleVertex inherits from BasicVertex instead of Vertex.

if (vertex != null) {
   ((MutableVertex<I, V, E, M>) vertex).setVertexId(vertexIndex);
   partition.putVertex((Vertex<I, V, E, M>) vertex);
} else if (originalVertex != null) {
  partition.removeVertex(originalVertex.getVertexId());
}

I did a simple change: cast LongDoubleFloatDoubleVertex to BasicVertex. The problem went away, and the algorithm finished without any error. But I am not sure this change has any implication to other parts of the code. So, I hope to get some comments from the Giraph developers.

if (vertex != null) {
   ((MutableVertex<I, V, E, M>) vertex).setVertexId(vertexIndex);
   partition.putVertex((BasicVertex<I, V, E, M>) vertex);
} else if (originalVertex != null) {
  partition.removeVertex(originalVertex.getVertexId());
}

Thanks,
Yuanyuan Tian
Research Staff Member
IBM Almaden Research Center
650 Harry Road
San Jose, California 95120-6099
(408) 927-1704