Class: WeightedDirectedGraph

Inherits:
WeightedGraph show all
Defined in:
lib/data_structures/weighted_directed_graph.rb

Instance Method Summary collapse

Methods inherited from WeightedGraph

#[], #add_vertex, #adjacent?, #adjacent_vertices, #delete_vertex, #highest_weight_adjacent, #initialize, #lowest_weight_adjacent

Constructor Details

This class inherits a constructor from WeightedGraph

Instance Method Details

#create_edge(origin_id, end_id, weight) ⇒ Object



4
5
6
# File 'lib/data_structures/weighted_directed_graph.rb', line 4

def create_edge(origin_id, end_id, weight)
  @adjacency_list[origin_id][end_id] = weight
end

#delete_edge(origin_id, end_id) ⇒ Object



8
9
10
# File 'lib/data_structures/weighted_directed_graph.rb', line 8

def delete_edge(origin_id, end_id)
  @adjacency_list[origin_id].delete(end_id)
end