class Ogr::EdgeBag

Bag for Edge objects

Public Class Methods

new() click to toggle source
# File lib/ogr/graphs/edge_bag.rb, line 5
def initialize
  @store = []
end

Public Instance Methods

add(x, weight) click to toggle source
# File lib/ogr/graphs/edge_bag.rb, line 9
def add(x, weight)
  @store.push v: x, weight: weight
end
each(&block) click to toggle source
# File lib/ogr/graphs/edge_bag.rb, line 21
def each(&block)
  @store.each(&block)
end
get(x) click to toggle source
# File lib/ogr/graphs/edge_bag.rb, line 17
def get(x)
  @store.find { |edge| edge[:v] == x }
end
remove(x) click to toggle source
# File lib/ogr/graphs/edge_bag.rb, line 13
def remove(x)
  @store.delete_if { |edge| edge[:v] == x }
end
size() click to toggle source
# File lib/ogr/graphs/edge_bag.rb, line 25
def size
  @store.size
end