Jyoti - I recently did a similar thing. In fact, my approach was exactly what 
Maja suggested. However, there is a caveat. You can switch computation class 
for workers in mastercompute's compute method but that requires the messages 
sent by computation class active before switching and messages received by 
computation class after switching to be the same.
For instance 
Superstep 1 - Compute-A (M1)Superstep 2 - Compute-A (M1)Superstep 3 - 
Compute-B(receive M1, outgoing is M2) --> you can achieve this using 
AbstractComputation, instead of BasicComputation.However, if Compute-B needs to 
be used in superstep-4 as well i.e.Superstep 4 - Compute-B [it receives M2 but 
that conflicts with its definition]
So in this case the trick isSuperstep 1 - Compute-A (M1)Superstep 2 - Compute-A 
(M1)time to switchSuperstep 3 - NoOpMessageSink extends 
AbstractComputation<I,V,E,M1,M2> whose compute() = { translate M1-> M2}make the 
switchSuperstep 4 - Compute-B (M2)Superstep 5 - Compute-B (M2)
and so on.
If your compute functions change alternatively then u can extend 
AbstractComputation likeSuperstep 1 - Compute-A (extends AbstractComputation 
<M1, M2>)Superstep 2 - Compute-B (extends AbstractComputation <M2, 
M1>)Superstep 3 - Compute-A (extends AbstractComputation <M1, M2>)Superstep 4 - 
Compute-B (extends AbstractComputation <M2, M1>)
@Maja, please add-to /correct what I wrote.
Thanks.
From: majakabi...@fb.com
To: user@giraph.apache.org
Subject: Re: Running one compute function after another..
Date: Sat, 11 Jan 2014 19:01:08 +0000






Hi Jyoti,



A cleaner way to do this is to switch Computation class which is used in the 
moment your condition is satisfied. So you can have an aggregator to check 
whether the condition is met, and then in your MasterCompute you call 
setComputation(SecondComputationClass.class)
 when needed.



Regards,
Maja





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

Reply-To: "user@giraph.apache.org" <user@giraph.apache.org>

Date: Saturday, January 11, 2014 10:48 AM

To: "user@giraph.apache.org" <user@giraph.apache.org>

Subject: Re: Running one compute function after another..









Hi ????? ??π???????...


I will go by this..


Thanks...






On Sat, Jan 11, 2014 at 10:52 PM, ????? ??π??????? 
<ikapo...@csd.auth.gr> wrote:


Hey,



You can have a boolean variable initially set to true(or false, whatever). Then 
you divide your code based on the value of that variable with an if-else 
statement. For my example, if the value is true then it goes through the first 
'if'. When the condition
 you want is fullfilled, change the value of the variable to false (at all 
nodes) and then the second part will be executed.



Ilias



???? 11/1/2014 6:18 ??, ?/? Jyoti Yadav ??????:




Hi folks..





In my algorithm,all vertices execute one compute function upto certain 
condition, when that condition is fulfilled,i want that all vertices now 
execute another compute function.Is it possible??



Any ideas are highly appreciated..



Thanks

Jyoti













                                          

Reply via email to