Module: Algorithmable::Graphs

Defined in:
lib/algorithmable/graphs.rb,
lib/algorithmable/graphs/traversals.rb,
lib/algorithmable/graphs/undirected.rb,
lib/algorithmable/graphs/traversals/errors.rb,
lib/algorithmable/graphs/traversals/depth_first.rb,
lib/algorithmable/graphs/traversals/breadth_first.rb

Defined Under Namespace

Modules: Traversals Classes: Undirected

Class Method Summary collapse

Class Method Details

.new_undirected_graph(vertices = []) ⇒ Object


7
8
9
10
11
12
13
# File 'lib/algorithmable/graphs.rb', line 7

def new_undirected_graph(vertices = [])
  graph = Undirected.new(vertices.size)
  vertices.each do |left, right|
    graph.add_edge left, right
  end
  graph
end