Giter Site home page Giter Site logo

dijkstra's Introduction

Dijkstra vs. A Star

This repository contains two Java implementations. One is of Dijkstra's shortest path algorithm and the other is of the A Star algorithm. Both were compared on computational time using the included three topo files. Each file contains increasing amounts of nodes to see how each algorithm responds to more complex networks. The topo files represent graph abstractions where each line in the file represents the cost between two nodes. The first two values in the a line are node numbers and the third value is the cost between them which is used by each of the algorithms for computing the shortest path.

Within the algorithms, these files are read in by entering the correct amount of nodes (4, 8, 16) when prompted. Providing a value other then these three throws an exception. Also, within the code, each of these files is converted to the 2D array called 'costs.'

To Run and Test the Code Yourself Both .java files must be compiled to produce binaries. On my system this was done via a bash terminal using JDK11, however they could easily be compiled in an IDE as well. Once compiled, be sure that you have downloaded the topo.txt files and changed the paths within the code of each .java file to represent the paths to those downloads. The variables to change the paths to are the constants FILE_4, FILE_8, and FILE_16.

Again, once you run the program, you will initially be prompted for the number of desired nodes. You must enter 4, 8, or 16 in addition to having followed the above instructions in order for the programs to run properly. Entering an node value other than 4, 8, or 16 or not having correctly updated the paths to those variables will throw an exception.

dijkstra's People

Contributors

geoffzc 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.