Hi Nick,
Giraph needs to have be able to instantiate the vertex id, value,
edges, and messages and there can only be a single type for each
of them.
That being said, since all the types are user chosen, you can
basically implement types that support multiple types inside of
it. As a simple, stupid example
class MessageA {
...
}
class MessageB {
...
}
class MultiMessage implements Writable {
private MessageA msgA;
private MessageB msgB;
private boolean useMsgA;
pubic MessageA getMsgA(){
return msgA;
}
pubic MessageB getMsgB(){
return msgB;
}
...
}
I didn't try and compile it, but hopefully you get the idea. =)
On 7/27/12 9:52 AM, Jonathan Bishop wrote:
Nick,
I am guessing it is because Giraph needs to move vertices around
and needs to construct them before it reads in their
serialization. I am new to Giraph myself so this may be incorrect.
Maybe Avery could comment.
Jon
On Fri, Jul 27, 2012 at 6:32 AM, Nick
West
wrote:
Thanks for the quick reply.
That (using one uber-class) was my initial thought when
I ran into this problem, however I was wondering if there
was a solution that would use the type hierarchy (which
admittedly is a bit more flexible in scala than java, so
this may not be possible). Is there something in the
Giraph architecture that precludes this?
Thanks,
Nick
On Jul 25, 2012, at 7:11 PM, Jonathan Bishop
wrote:
Nick,
You may want to reconsider your approach as I
don't think Giraph will be happy with this.
How about using a new vertex value class with
BasicVertex which can do both behaviours for
you? Same for edge and message classes. This
should be enough do what you want.
Jon
On Wed, Jul 25, 2012 at 3:29 PM,
Nick West
wrote:
Hi,
I'm working on implementing a belief
propagation algorithm over Giraph. (Do
you know if anyone has done this
before?) This requires having (at
least) two different types of vertices
implemented (values and factors) and
different types of messages sent between
different vertices.
I've been able to set up and run my
own vertices (with my own custom readers
and writers), however, whenever I try to
extend this to a more complex case I
run into problems. For example, suppose
aI have the following two vertex types:
class FooVertex() extends
BasicVertex[IntWritable, IntWritable,
Text, IntWritable]
class BarVertex() extends
BasicVertex[IntWritable, IntWritable,
Text, IntWritable]
(both of which run fine in the basic
set up), and I then configure the
GiraphJob with the following,