giraph-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo Castagna <castagna.li...@googlemail.com>
Subject Re: Should it be possible to extend BasicVertex<I,V,E,M>?
Date Mon, 21 May 2012 17:08:54 GMT
Benjamin Heitmann wrote:
> On 21 May 2012, at 17:15, Paolo Castagna wrote:
>> A more direct question would be: are Giraph supposed to extend
>> BasicVertex<I,V,E,M> when they do not find a subclass of BasicVertex which
meets
>> their needs?
> 
> 
> No, they are not. However this is not explicitly documented anywhere. 
> 
> Or to say it more clearly: If you look in the javadoc of BasicVertex and if you search
the mailing lists, 
> then you will find that users are discouraged from using/extending BasicVertex, but you
will not find any suggestion of which 
> Vertex to extend instead. I even asked basically the same question once, and got very
indirect answers. 
> But that is okay, I figured it out by trial and error ;) 
> 
> 
> Users are supposed to extend HashMapVertex or EdgeListVertex (both in org.apache.giraph.graph).


Hi Benjamin,
right, I should have seen those (this is a good sign I should stop for today
and continue tomorrow morning). I didn't because I was thinking: "I do not need
my vertexes to be mutable" (since, computing PageRank does not need to change
the topology of a graph), so I was not focusing my attention on the
MutableVertex hierarchy of classes (my mistake).

Now my question would be: why SimplePageRankVertex extends
LongDoubleFloatDoubleVertex? (But, I'll look at this tomorrow).

> 
> If you try to extend them, you will see that you can basically plug-in any kind of existing
class in the <I,V,E,M> signature, 
> as long as the implement the right interfaces, which are all Writable (and WritableComparable
for I). 
> Then you just need to add your compute() method, and you are ready to go. 
> Both HashMapVertex and EdgeListVertex provide implementations of all the housekeeping
that giraph needs.
> 
> Trying to work directly by extending BasicVertex will not work, as a lot of methods are
only accessibly on the same package level. 

Yep.

> It would probably be a good idea to submit a small javadoc patch which adds documentation
to BasicVertex, that users need to look at those other two classes. 
> 

Yep.

Thanks again for your help and for pointing me in the right direction.

Paolo

Mime
View raw message