Skip to content

Instantly share code, notes, and snippets.



Created Sep 25, 2015
What would you like to do?
require 'rgl/implicit'
require 'rgl/traversal'
vertices = ["one", "two", "three"]
g = do |g|
g.vertex_iterator { |b|{|v| } }
g.adjacent_iterator { |x, b| vertices[(vertices.index(x) - 1).abs] ) }
g.directed = true
t = g.bfs_search_tree_from("one")
puts t.has_vertex?("two") # true
puts t.has_vertex?("three") # false

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.