Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

felipecrs/ac318-shortest-distance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shortest Distance algorithm for AC318 class

Calculates the shortest distance between cities using the Floyd Marshall algorithm

Developed with JetBrains WebStorm. Using it is optional, but will produce better-printed results on the console.

Requisites

Building

  • Clone the repository
  • Open a command prompt/terminal in the cloned project folder
  • Run this command to install the project dependencies
      $ npm install
  • Run this command to build and run the project
      $ node index.js

Usage

You just have to build and run, the project will look for a file coordenadas.csv in the same folder for importing the coordinates. Then it will calculate the matrix of distances using the haversine formula, and lastly, it will determine the shortest distances between all cities. It will print on the console all the three steps results.

Dependencies

  • csvtojson: Used for reading the CSV file.
  • haversine: Used for calculating the distance between two coordinates.
  • floyd-warshall: Used for determining the shortest distances between all cities.
  • console.table: Used for a better-printed matrix on the console

About

Calculates the shortest distance between cities using the Floyd Marshall algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published