Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hama Wiki" for change notification.
The "Aggregators" page has been changed by AnastasisAndronidis: https://wiki.apache.org/hama/Aggregators?action=diff&rev1=7&rev2=8 === Introduction === Quoting from Pregel paper: ''aggregators are a mechanism for global communication, monitoring, and data. Each vertex can provide a value to an aggregator in superstep S, the system combines those values using a reduction operator, and the resulting value is made available to all vertices in superstep S + 1.'' - You can think aggregators as a tree, that the leafs (which are the graph vertices) are sending messages to the root (the master aggregator), and then the root is combining all these messages to a value. In the end, this combined values is distributed back to the leafs. Aggregators are useful for statistics (think of an histogram of vertex degrees) or for global controlling. + You can think aggregators as a tree, that the leaves (which are the graph vertices) are sending messages to the root (the master aggregator), and then the root is combining all these messages to a value. In the end, this combined values are distributed back to the leaves. Aggregators are useful for statistics (think of an histogram of vertex degrees) or for global management. === Registering aggregators === - To start using aggregators, you must register them in your GraphJob. + To start using aggregators, you must declare them in your GraphJob. e.g. {{{ @@ -22, +22 @@ graphJob.setAggregatorClass(SumAggregator.class); }}} - There are lots of different aggregators and you can also make your own. Look for already implemented aggregators in org.apache.hama.graph package. + There are multiple different aggregators and you can also make your own. You can look for already implemented aggregators in org.apache.hama.graph package. === Start working with aggregators === - To start aggregating values from your vertices, is very easy and strait forward. From your vertex, use: + In order to aggregate values, from your vertex, use: {{{ this.aggregate(index,value); }}} - The index parameter of this method is a number that is equivalent to the order of the registered aggregator. (The first registered aggregator is number 0, second is number 1 etc.) + The index parameter of this method is a number that is equivalent to the order of the registered aggregator. (The first registered aggregator has index 0, second has index 1 etc.) === Get results === - Inside your vertex, you can get the results of each aggregator by using this method: + Inside your vertex, you can get the results of each aggregator by using the method: - {{{ this.getAggregatedValue(index); }}} === Write your own aggregators === - To write your own aggregator, you have o extend AbstractAggregator class and implement the methods of #aggregate(M value) and #getValue(). For more, please see the default implemented aggregators in org.apache.hama.graph package. + To write your own aggregator, you have to extend AbstractAggregator class and implement the methods of #aggregate(M value) and #getValue(). For more, please see the default implementation of aggregators in org.apache.hama.graph package.
