Class: DAG::Edge
- Inherits:
-
Object
- Object
- DAG::Edge
- Defined in:
- lib/zipf/dag.rb
Instance Attribute Summary collapse
-
#head ⇒ Object
Returns the value of attribute head.
-
#mark ⇒ Object
Returns the value of attribute mark.
-
#tail ⇒ Object
Returns the value of attribute tail.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(tail = nil, head = nil, weight = 0) ⇒ Edge
constructor
A new instance of Edge.
- #to_s ⇒ Object
Constructor Details
#initialize(tail = nil, head = nil, weight = 0) ⇒ Edge
Returns a new instance of Edge.
33 34 35 36 37 38 |
# File 'lib/zipf/dag.rb', line 33 def initialize tail=nil, head=nil, weight=0 @tail = tail @head = head @weight = weight @mark = false # did we already follow this edge? -- for topological sorting end |
Instance Attribute Details
#head ⇒ Object
Returns the value of attribute head.
31 32 33 |
# File 'lib/zipf/dag.rb', line 31 def head @head end |
#mark ⇒ Object
Returns the value of attribute mark.
31 32 33 |
# File 'lib/zipf/dag.rb', line 31 def mark @mark end |
#tail ⇒ Object
Returns the value of attribute tail.
31 32 33 |
# File 'lib/zipf/dag.rb', line 31 def tail @tail end |
#weight ⇒ Object
Returns the value of attribute weight.
31 32 33 |
# File 'lib/zipf/dag.rb', line 31 def weight @weight end |
Instance Method Details
#to_s ⇒ Object
40 41 42 43 44 45 |
# File 'lib/zipf/dag.rb', line 40 def to_s s = "DAG::Edge<#{@tail} ->[#{weight}] #{@head}" s += " x" if @mark s += ">" s end |