Giter Site home page Giter Site logo

rmahnovetsky / shortest_path Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cityway-soft/shortest_path

0.0 2.0 0.0 232 KB

A* ruby implementation to find shortest path and map in a graph.

Home Page: https://github.com/dryade/shortest_path.git

License: MIT License

Ruby 100.00%

shortest_path's Introduction

Shortest Path

Build Status Dependency Status Code Climate Coverage Status

A* ruby implementation to find shortest path and map in a graph with :

  • a timeout to stop research when duration > timeout
  • a context in a hash for each point in the graph
  • the possibility to override default methods

Requirements

This code has been run and tested on Ruby 1.9 or later

External Deps

On Debian/Ubuntu/Kubuntu OS :

sudo apt-get install git

gcc is for priority queue.

Installation

This package is available in RubyGems and can be installed with:

gem install shortest_path

Test

bundle exec rake spec

More Information

More information can be found on the project website on GitHub. There is extensive usage documentation available on the wiki.

Example Usage

Create a basic shortest path finder :

# Create a graph
graph = {   :a => { :e => 3, :b => 1, :c => 3},
                :b => {:e => 1, :a => 1, :c => 3, :d => 5},
                :c => {:a => 3, :b => 3, :d => 1, :s => 3},
                :d => {:b => 5, :c => 1, :s => 1},
                :e => {:a => 3, :b => 1},
                :s => {:c => 3, :d => 1} }
}

# Create a finder
finder = ShortestPath::Finder.new(:a, :e).tap do |shortest_path|
  shortest_path.ways_finder = Proc.new { |node| graph[node] }
end

# Change the timeout in seconds
finder.timeout = 2

# Call graph result
finder.path

Overwrite shortest path finder : Find an example in activeroad project

License

This project is licensed under the MIT license, a copy of which can be found in the LICENSE file.

Support

Users looking for support should file an issue on the GitHub issue tracking page (https://github.com/dryade/shortest_path/issues), or file a pull request (https://github.com/dryade/shortest_path/pulls) if you have a fix available.

shortest_path's People

Contributors

mflorisson avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.