Skip to content

Instantly share code, notes, and snippets.

@sirmxanot
Created November 15, 2012 04:39
Show Gist options
  • Save sirmxanot/4076682 to your computer and use it in GitHub Desktop.
Save sirmxanot/4076682 to your computer and use it in GitHub Desktop.
#this is preferable
graph[vertex_delete].each do |edge|
graph[edge].map! do |vertex|
vertex == vertex_delete ? vertex_keep : vertex
end
end
#to this?
graph[vertex_delete].each {|edge| graph[edge].map! {|vertex| vertex == vertex_delete ? vertex_keep : vertex}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment