Module: Apress::Documentation::Extensions::RGL::Adjacency

Defined in:
lib/apress/documentation/extensions/rgl/adjacency.rb

Instance Method Summary collapse

Instance Method Details

#replace_vertex(old_v, new_v) ⇒ Object

Private: Расширение графа для замены вершины на новую



7
8
9
10
11
12
13
# File 'lib/apress/documentation/extensions/rgl/adjacency.rb', line 7

def replace_vertex(old_v, new_v)
  @vertices_dict[new_v] = @vertices_dict.delete(old_v)

  @vertices_dict.each_value do |list|
    list.add(new_v) if list.delete?(old_v)
  end
end