Class: Clusta::Geometry::DirectedDegree

Inherits:
Element
  • Object
show all
Defined in:
lib/clusta/geometry/directed/degree.rb

Instance Attribute Summary

Attributes included from Schema

#extra_inputs

Instance Method Summary collapse

Methods inherited from Element

inherited

Methods included from Serialization::TSV

#extra_inputs=, #extra_outputs, included, #process_args, #suffix, #to_flat, #to_tsv_component

Methods included from Serialization::JSON

included, #non_key_field_data, #process_args, #to_flat, #to_hash

Methods included from Serialization

included, #initialize, #process_args, #stream_name

Methods included from Schema

#extra_outputs, #fields, included, #keys, #non_key_fields

Instance Method Details

#+(other) ⇒ Object



24
25
26
27
# File 'lib/clusta/geometry/directed/degree.rb', line 24

def +(other)
  raise DirectednessMismatchError.new unless other.directed?
  self.class.new(vertex_label, self.in_degree + other.in_degree, self.out_degree + other.out_degree)
end

#directed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/clusta/geometry/directed/degree.rb', line 12

def directed?
  true
end

#one(inbound = 1, outbound = 0) ⇒ Object



20
21
22
# File 'lib/clusta/geometry/directed/degree.rb', line 20

def one inbound=1, outbound=0
  self.class.new(vertex_label, inbound, outbound)
end

#zeroObject



16
17
18
# File 'lib/clusta/geometry/directed/degree.rb', line 16

def zero
  self.class.new(vertex_label, 0, 0)
end