Yes, exactly. But in the above code snippet, the aggregate function is called twice, which means the value is changed twice. I have also inserted logs which confirm this.
2012/10/25 Thomas Jungblut <[email protected]> > Hi Sandy, > it's up to the concrete aggregator to define the behaviour. In case of > pagerank there is the AverageAggregator is defined. > It inherits from the AbsDiffAggregator which takes the absolute difference > of the old value to the new value. > The AverageAggregator then just averages this difference over all > accumulated values in the graph. > > 2012/10/25 Sandy Ding <[email protected]> > > > Hi, all > > > > When I checked the source code, I am confused about how the globa error > of > > pagerank is calculated. > > It seems to me that in bsp() (GraphJobRunner.java), after each vertex is > > computed, > > first aggregate(vertex, vertex.getValue()) is called, > > then aggregate(vertex, lastValue, vertex.getValue()) is also called. > > > > <the last part of bsp() function in GraphJobRunner.java> > > if (aggregators != null) { > > 283 if (this.aggregators != null) { > > 284 for (int i = 0; i < this.aggregators.length; i++) { > > 285 Aggregator<M, Vertex<V, E, M>> aggregator = > > this.aggregators[i]; > > 286 aggregator.aggregate(vertex, vertex.getValue()); > > 287 if (isAbstractAggregator[i]) { > > 288 AbstractAggregator<M, Vertex<V, E, M>> intern = > > ((AbstractAggregator<M, Vertex<V, E, M>>) aggregator); > > 289 intern.aggregate(vertex, lastValue, > > vertex.getValue()); > > 290 intern.aggregateInternal(); > > 291 } > > 292 } > > 293 } > > 294 } > > > > This means that both the vertex value and the difference will be added to > > compute the global error. > > But I think intuitively only the difference should be accumulated. > > So what's the consideration? Or do I have some misunderstandings? > > > > Best > > Sandy > > >
