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). 

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. 


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. 

Reply via email to