Class: Clusta::Transforms::EdgesToNeighborhoods::Reducer
- Inherits:
-
Wukong::Streamer::AccumulatingReducer
- Object
- Wukong::Streamer::AccumulatingReducer
- Clusta::Transforms::EdgesToNeighborhoods::Reducer
- Includes:
- Wukong::Streamer::StructRecordizer
- Defined in:
- lib/clusta/transforms/edges_to_neighborhoods.rb
Instance Attribute Summary collapse
-
#directed ⇒ Object
Returns the value of attribute directed.
-
#neighbors ⇒ Object
Returns the value of attribute neighbors.
Instance Method Summary collapse
- #accumulate(new_edge, *record) ⇒ Object
- #finalize(&block) ⇒ Object
- #get_key(new_edge, *record) ⇒ Object
- #start!(new_edge, *record) ⇒ Object
Instance Attribute Details
#directed ⇒ Object
Returns the value of attribute directed.
23 24 25 |
# File 'lib/clusta/transforms/edges_to_neighborhoods.rb', line 23 def directed @directed end |
#neighbors ⇒ Object
Returns the value of attribute neighbors.
23 24 25 |
# File 'lib/clusta/transforms/edges_to_neighborhoods.rb', line 23 def neighbors @neighbors end |
Instance Method Details
#accumulate(new_edge, *record) ⇒ Object
38 39 40 |
# File 'lib/clusta/transforms/edges_to_neighborhoods.rb', line 38 def accumulate new_edge, *record self.neighbors << new_edge.neighbor end |
#finalize(&block) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/clusta/transforms/edges_to_neighborhoods.rb', line 42 def finalize &block if directed emit Geometry::DirectedNeighborhood.new(vertex_label, *neighbors) else emit Geometry::Neighborhood.new(vertex_label, *neighbors) end end |
#get_key(new_edge, *record) ⇒ Object
29 30 31 |
# File 'lib/clusta/transforms/edges_to_neighborhoods.rb', line 29 def get_key new_edge, *record new_edge.source_label end |
#start!(new_edge, *record) ⇒ Object
33 34 35 36 |
# File 'lib/clusta/transforms/edges_to_neighborhoods.rb', line 33 def start! new_edge, *record self.neighbors = [] self.directed = new_edge.directed? end |