You can also set a variable outside of the compute function, at the private part of the class. You will have to instantiate it at superstep 0 though, else you will have a NullPointerException thrown, in case you use it at superstep 1.


Quoting Jyoti Yadav <rao.jyoti26ya...@gmail.com>:

Thanks Ameya...I will give a try to your ideas...


On Sun, Nov 17, 2013 at 3:17 PM, Ameya Vilankar <ameya.vilan...@gmail.com>wrote:

In your scenario, you want to store some value that is obtained in
Superstep 1, so that it is available to a vertex in all the subsequent
supersteps. The best place to do that is to store it on the vertex itself.
The simplest example is ShortesPath Example where you store the current
lowest distance on the vertex, and when you receive a message you update it
with the new lowest mistake. I assume that in your program you don't want
to update the value after Superstep 1. So don't. Just keep an extra
variable in your vertex value class and set it in superstep 1 so that it
can be used by the vertex in all the following steps.

But if you want to store global information i.e in superstep 1, every
vertex computes and stores a value and in the subsequent supersteps, a
vertex needs access to the stored values of all the vertices, you need to
make those values global. The only way to do it is to use a persistent
aggregator. In superstep 1, every vertex computes the value and then sends
it to the persistent aggregator that can contain a hashmap from the vertex
id to the value. This value will persist across all the supersteps since
the aggregator is a persistent one. Will be available to every vertex too.


On Sun, Nov 17, 2013 at 1:11 AM, Mirko Kämpf <mirko.kae...@cloudera.com>wrote:

Hi,

if it is a local value, just important for that given vertex, it might
work with a local variable, maybe even a more complex data structure, e.g.
a Stack or a FIFO buffer, to handle "old" data. I do not consider to
exchange data between vertexes, only within one vertex over time.

I write this here, to share my idea, but I am not really sure if a Giraph
vertex works like this. It's just how I would try it ...

But I think we will see a definitive answer soon.

Have a nice day!
Mirko


On Sun, Nov 17, 2013 at 6:55 AM, Jyoti Yadav <rao.jyoti26ya...@gmail.com>wrote:

Hi folks...

while executing my program ,i came across a doubt which is creating
problem...

Scenario....

In compute() function,
Suppose in superstep1 each vertex want to save some value so that every
vertex can use its  previously saved value in upcoming supersteps...Is it
possible???


Any ideas are really appreciated...

Thanks...
Jyoti











Reply via email to