Giter Site home page Giter Site logo

codeesura / dijkstra-algorithm Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 545 KB

This project offers a JavaScript implementation of Dijkstra's algorithm with a user-friendly PriorityQueue class, ideal for finding the shortest paths in complex graphs as in routing or network optimization.

License: MIT License

JavaScript 100.00%
algorithm dijkstra dijkstra-algorithm shortest-path shortest-path-algorithm shortest-path-routing-algorithm shortest-paths

dijkstra-algorithm's Introduction

Contributors Forks Stars Issues MIT License


Logo

Dijkstra Algorithm Implementation

A robust and efficient JavaScript implementation of the Dijkstra Algorithm to solve the shortest path problem in graph data structures.
View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

Dijkstra Algorithm

This project introduces a highly efficient JavaScript implementation of the renowned Dijkstra's algorithm, wrapped in a user-friendly PriorityQueue class. It's designed for those who need to find the shortest path in complex network graphs, like the ones commonly found in routing and navigation problems or network flow optimization.

Here's why this project stands out:

  • Time-Efficiency: You can integrate this into your systems to solve shortest-path problems with blazing speed.
  • Ease of Use: The PriorityQueue class abstracts the complexity of the algorithm, providing a clean and simple interface for users to implement in their projects.
  • DRY Code: Why reinvent the wheel? The modular design follows the DRY (Don't Repeat Yourself) principle, making your coding process more efficient.

This template is not just a mere set of functions; it's a comprehensive solution for those looking to enhance their applications with optimal pathfinding capabilities. The project is open for contributions, and suggestions for improvements are always welcome. Whether you're dealing with financial networks, social networks, or logistical maps, this algorithm is versatile enough to cater to a wide array of applications.

Use this template to jump-start your project, and never worry about the underlying complexities of graph-based problem solving again.

(back to top)

Getting Started

To set up this project locally, follow these simple steps.

Prerequisites

This project uses bun for dependency management. Make sure you have bun installed on your system.

  • bun
    curl -fsSL https://bun.sh/install | bash

Installation

  1. Clone the repo
    git clone https://github.com/codeesura/dijkstra-algorithm.git
  2. Install bun packages
    bun install

(back to top)

Usage

The main.js file includes a PriorityQueue class and an implementation of Dijkstra's algorithm. Here's how you can use it in your project:

PriorityQueue Example

let pq = new PriorityQueue();
pq.enqueue("Item1", 1);
pq.enqueue("Item2", 2);
let item = pq.dequeue(); // Returns "Item1"

Dijkstra's Algorithm Example

let graph = {
  start: { A: 6, B: 2 },
  A: { finish: 1 },
  B: { A: 3, finish: 5 },
  finish: {}
};

let costs = dijkstra(graph);

(back to top)

Roadmap

  • Implement PriorityQueue class.
  • Implement Dijkstra's algorithm.
  • Add additional examples and more complex use cases in documentation.
  • Create an extended guide for different scenarios where Dijkstra's algorithm can be applied.
  • Implement additional graph algorithms and data structures for broader utility.

Check the open issues for a list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make to the PriorityQueue and Dijkstra's algorithm implementation are greatly appreciated.

If you have a suggestion that would make this better, please fork the repository and create a pull request or open an issue with the tag "enhancement". Don't forget to give the project a star if you find it helpful! Thank you for your support!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

codeesura - @codeesura - [email protected]

Project Link: https://github.com/codeesura/dijkstra-algorithm

(back to top)

Acknowledgments

This project wouldn't be possible without the extensive resources available for understanding and implementing Dijkstra's algorithm. We'd like to acknowledge the following:

These resources have contributed significantly to the development of the Dijkstra's algorithm implementation in our project and are highly recommended for anyone looking to deepen their understanding of graph algorithms.

(back to top)

dijkstra-algorithm's People

Contributors

codeesura avatar

Watchers

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