Sha256: ff0da7c8d9a95b99a62d4c7843844e668a034aa2836ae968c41be12dfc2077cb
Contents?: true
Size: 661 Bytes
Versions: 3
Compression:
Stored size: 661 Bytes
Contents
require 'test/unit' # Do not require rgl/adjacency ! require 'rgl/traversal' require 'rgl/implicit' include RGL # Cyclic graph with _n_ vertices. Need a concrete graph, that is not an AdjacencyGraph def cycle(n) RGL::ImplicitGraph.new { |g| g.vertex_iterator { |b| 0.upto(n - 1, &b) } g.adjacent_iterator { |x, b| b.call((x + 1) % n) } g.directed = true } end class TestAdjacencyNotRequired < Test::Unit::TestCase def setup @dg = cycle(4) end def test_bfs_search_tree # bfs_search_tree_from requires rgl/adjacency if not yet loaded. assert_equal("(1-2)(2-3)(3-0)", @dg.bfs_search_tree_from(1).edges.sort.join) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rgl-0.6.6 | test/traversal_bfs_require.rb |
rgl-0.6.5 | test/traversal_bfs_require.rb |
rgl-0.6.4 | test/traversal_bfs_require.rb |