Class: Graphos::Weighted::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/graphos/weighted/edge.rb

Overview

This class represents an edge in a weighted graph

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject (readonly)

Returns the value of attribute from.



8
9
10
# File 'lib/graphos/weighted/edge.rb', line 8

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



8
9
10
# File 'lib/graphos/weighted/edge.rb', line 8

def to
  @to
end

#weightObject (readonly)

Returns the value of attribute weight.



8
9
10
# File 'lib/graphos/weighted/edge.rb', line 8

def weight
  @weight
end