Class: Graphos::Weighted::Edge
- Inherits:
-
Object
- Object
- Graphos::Weighted::Edge
- Defined in:
- lib/graphos/weighted/edge.rb
Overview
This class represents an edge in a weighted graph
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(from, to, weight) ⇒ Edge
constructor
A new instance of Edge.
Constructor Details
#initialize(from, to, weight) ⇒ Edge
Returns a new instance of Edge.
9 10 11 |
# File 'lib/graphos/weighted/edge.rb', line 9 def initialize from, to, weight @from, @to, @weight = from, to, weight end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
8 9 10 |
# File 'lib/graphos/weighted/edge.rb', line 8 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
8 9 10 |
# File 'lib/graphos/weighted/edge.rb', line 8 def to @to end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
8 9 10 |
# File 'lib/graphos/weighted/edge.rb', line 8 def weight @weight end |