Giter Site home page Giter Site logo

isaric / pathfinder Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 211 KB

A demo spring boot application that uses the JGraphT library to find routes in a simplified world map.

License: MIT License

Java 100.00%
graph-algorithms graphs spring-boot spring-web java jgrapht

pathfinder's Introduction

PATHFINDER

Java CI with Maven

This is a simple Spring Boot REST application that will calculate the number of border crossings (hops) needed to get from the origin country to the destination country if a land route exists. It does not take into account the size of a particular country. Each is considered equal large as a border crossing.

How to run?

The application uses maven as a build tool and dependency manager. It will produce a JAR file once a build is successful. Follow the standard procedure for building and running a Java Maven application or use your favorite IDE to do it for you.

The application has some basic integration tests to make sure the core functionality is working.

API usage

The application exposes a single endpoint. The "origin" and "destination" varibles are three-letter strings representing the country codes. In case no route is possible or the string constraints are not respected the API will return status 400. The response payload in case of success if a list of all three-letter country codes from the origin country to the destination country.

GET /routes/{origin}/{destination} HTTP 200,400

{ 
   "route" : ["HRV", "SLO", "AUT"] 
}

Implementation notes

The country data is a JSON file that is ingested at application startup. The application then proceeds to calculate every possible combination of origin and destination. This means all possible results will be stored in the in-memory cache and all requests made to the application will be executed in the minimal amount of time possible.

The algorithm used to calculate the shortest path is Dijkstra's Shortest Path algorithm. The "world" is modeled as an undirected, unweighted graph.

pathfinder's People

Contributors

isaric avatar

Watchers

 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.