class RubyAi::Search::Edge

Attributes

cost[R]
end_vertex[R]
start_vertex[R]

Public Class Methods

new(start_vertex:, end_vertex:, cost:) click to toggle source
# File lib/ruby_ai/search/edge.rb, line 6
def initialize(start_vertex:, end_vertex:, cost:)
  @start_vertex = start_vertex
  @end_vertex = end_vertex
  @cost = cost
end

Public Instance Methods

==(other) click to toggle source
# File lib/ruby_ai/search/edge.rb, line 12
def ==(other)
  self.class == other.class && 
  @start_vertex == other.start_vertex &&
  @end_vertex   == other.end_vertex &&
  @cost         == other.cost 
end
to_s() click to toggle source
# File lib/ruby_ai/search/edge.rb, line 19
def to_s
  "edge: #{@start_vertex} (#{@cost}) #{@end_vertex}"
end