Skip to content

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

Notifications You must be signed in to change notification settings

codeesura/dijkstra-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 - codeesura@gmail.com

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)

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published