Hello

I'm trying to implement the ForceAtlas2 (graph layout) algorithm in Flink
using datasets, it is an iterative algorithm and I have most of it ready,
but there is something I don't know how to do. Apart from the dataset with
the coordinates (x,y) of each node I need an additional variable to
regulate the speed, very simplified it would be something like this:

DataSet<Node> nodes = env.fromCollection(nodesList);
Double speed = 1.0;
nodes.iterate(100) {
   nodes = nodes with forces to apply calculated;
   speed = speed regulated based on previous value and forces calculated;
   nodes = nodes coordinates updated with forces * speed;
} closesWith(nodes)

In my case, the nodes are the dataset I'm iterating over and it is working
perfect if I forget about speed, but I don't know how to keep speed
variable updated in every iteration to be able to use it in the next one

Any suggestions? Thanks

Reply via email to