Class: DS::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/ds/graphs/edge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject

Returns the value of attribute from.



4
5
6
# File 'lib/ds/graphs/edge.rb', line 4

def from
  @from
end

#toObject

Returns the value of attribute to.



4
5
6
# File 'lib/ds/graphs/edge.rb', line 4

def to
  @to
end

#weightObject

Returns the value of attribute weight.



4
5
6
# File 'lib/ds/graphs/edge.rb', line 4

def weight
  @weight
end