Class: Clusta::Transforms::DegreePairsToAssortativities::Reducer
- Inherits:
-
Wukong::Streamer::AccumulatingReducer
- Object
- Wukong::Streamer::AccumulatingReducer
- Clusta::Transforms::DegreePairsToAssortativities::Reducer
- Includes:
- Wukong::Streamer::StructRecordizer
- Defined in:
- lib/clusta/transforms/degree_pairs_to_assortativities.rb
Instance Attribute Summary collapse
-
#assortativity ⇒ Object
Returns the value of attribute assortativity.
Instance Method Summary collapse
- #accumulate(new_assortativity, *record) ⇒ Object
- #finalize(&block) ⇒ Object
- #get_key(new_assortativity, *record) ⇒ Object
- #start!(new_assortativity, *record) ⇒ Object
Instance Attribute Details
#assortativity ⇒ Object
Returns the value of attribute assortativity.
21 22 23 |
# File 'lib/clusta/transforms/degree_pairs_to_assortativities.rb', line 21 def assortativity @assortativity end |
Instance Method Details
#accumulate(new_assortativity, *record) ⇒ Object
33 34 35 |
# File 'lib/clusta/transforms/degree_pairs_to_assortativities.rb', line 33 def accumulate new_assortativity, *record self.assortativity += new_assortativity end |
#finalize(&block) ⇒ Object
37 38 39 |
# File 'lib/clusta/transforms/degree_pairs_to_assortativities.rb', line 37 def finalize &block emit self.assortativity end |
#get_key(new_assortativity, *record) ⇒ Object
25 26 27 |
# File 'lib/clusta/transforms/degree_pairs_to_assortativities.rb', line 25 def get_key new_assortativity, *record new_assortativity.key end |
#start!(new_assortativity, *record) ⇒ Object
29 30 31 |
# File 'lib/clusta/transforms/degree_pairs_to_assortativities.rb', line 29 def start! new_assortativity, *record self.assortativity = new_assortativity.zero end |