Class: HG::Hyperedge
- Inherits:
-
Object
- Object
- HG::Hyperedge
- Defined in:
- lib/zipf/hypergraph.rb
Instance Attribute Summary collapse
-
#f ⇒ Object
Returns the value of attribute f.
-
#head ⇒ Object
Returns the value of attribute head.
-
#left ⇒ Object
Returns the value of attribute left.
-
#mark ⇒ Object
Returns the value of attribute mark.
-
#right ⇒ Object
Returns the value of attribute right.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#tails ⇒ Object
Returns the value of attribute tails.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
- #arity ⇒ Object
-
#initialize(head = nil, tails = [], weight = 0.0, f = {}) ⇒ Hyperedge
constructor
A new instance of Hyperedge.
- #marked? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(head = nil, tails = [], weight = 0.0, f = {}) ⇒ Hyperedge
Returns a new instance of Hyperedge.
44 45 46 47 48 49 50 |
# File 'lib/zipf/hypergraph.rb', line 44 def initialize head=nil, tails=[], weight=0.0, f={} @head = head @tails = tails @weight = weight @f = f @mark = 0 end |
Instance Attribute Details
#f ⇒ Object
Returns the value of attribute f.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def f @f end |
#head ⇒ Object
Returns the value of attribute head.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def head @head end |
#left ⇒ Object
Returns the value of attribute left.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def left @left end |
#mark ⇒ Object
Returns the value of attribute mark.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def mark @mark end |
#right ⇒ Object
Returns the value of attribute right.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def right @right end |
#rule ⇒ Object
Returns the value of attribute rule.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def rule @rule end |
#tails ⇒ Object
Returns the value of attribute tails.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def tails @tails end |
#weight ⇒ Object
Returns the value of attribute weight.
42 43 44 |
# File 'lib/zipf/hypergraph.rb', line 42 def weight @weight end |
Instance Method Details
#arity ⇒ Object
52 53 54 |
# File 'lib/zipf/hypergraph.rb', line 52 def arity return @tails.size end |
#marked? ⇒ Boolean
56 57 58 |
# File 'lib/zipf/hypergraph.rb', line 56 def marked? arity == @mark end |
#to_s ⇒ Object
60 61 62 |
# File 'lib/zipf/hypergraph.rb', line 60 def to_s "Hyperedge<head:\"#{@head.label}\", \"tails:#{@tails.map{|n|n.label}}, arity:#{arity}, weight:#{@weight}, f:#{f.to_s}, mark:#{@mark}>" end |