Sha256: f4cbae8fcfac881fee9b920fcdcfe85b2cfc214f32779837b1f18a77002e18b1

Contents?: true

Size: 355 Bytes

Versions: 12

Compression:

Stored size: 355 Bytes

Contents

# frozen_string_literal: true

require 'rgl/traversal'

module RGL
  module Graph
    # Checks whether a path exists between _source_ and _target_ vertices
    # in the graph.
    #
    def path?(source, target)
      return false unless has_vertex?(source)

      bfs_iterator = bfs_iterator(source)
      bfs_iterator.include?(target)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rgl-0.6.6 lib/rgl/path.rb
rgl-0.6.5 lib/rgl/path.rb
rgl-0.6.4 lib/rgl/path.rb
rgl-0.6.3 lib/rgl/path.rb
rgl-0.6.2 lib/rgl/path.rb
rgl-0.6.1 lib/rgl/path.rb
rgl-0.6.0 lib/rgl/path.rb
rgl-0.5.10 lib/rgl/path.rb
rgl-0.5.9 lib/rgl/path.rb
rgl-0.5.8 lib/rgl/path.rb
rgl-0.5.7 lib/rgl/path.rb
rgl-0.5.6 lib/rgl/path.rb