Class: DS::Edge
- Inherits:
-
Object
- Object
- DS::Edge
- Defined in:
- lib/ds/graphs/edge.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#to ⇒ Object
Returns the value of attribute to.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(from, to, weight = 1) ⇒ Edge
constructor
Create new edge.
Constructor Details
#initialize(from, to, weight = 1) ⇒ Edge
Create new edge.
7 8 9 10 11 |
# File 'lib/ds/graphs/edge.rb', line 7 def initialize(from,to,weight=1) @from = from @to = to @weight = weight end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/ds/graphs/edge.rb', line 4 def from @from end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/ds/graphs/edge.rb', line 4 def to @to end |
#weight ⇒ Object
Returns the value of attribute weight.
4 5 6 |
# File 'lib/ds/graphs/edge.rb', line 4 def weight @weight end |