npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dijkstras

v0.0.3

Published

Efficient implementation of Dijkstra's algorithm, with TypeScript support. This package is designed to be usable in both Node.js and browsers.

Downloads

750

Readme

Dijkstras

Dijkstras is a simple and efficient npm package that implements Dijkstra's algorithm for finding the shortest path in a weighted graph. This package supports TypeScript, ES6 , CJS, and it is designed to be usable in both Node.js and browsers.

Installation

To start using Dijkstras in your Node.js project, follow these steps:

  1. Ensure that you have Node.js installed on your system. You can download it from https://nodejs.org.

  2. Open your terminal or command prompt.

  3. Navigate to your project directory.

  4. Run the following command to install Dijkstras via npm:

    npm install dijkstras
  5. Wait for the installation process to complete.

  6. Congratulations! You've successfully installed Dijkstras for your Node.js project.

Getting Started

To quickly get started with Dijkstras, follow these steps:

  1. Import the Dijkstras module in your Node.js script:

    import dijkstras from "dijkstras";

    or :

    const dijkstras = require("dijkstras");
  2. Create a graph and use the provided methods to find the shortest path:

const graph = {
  a: { b: 10, d: 1 },
  b: { a: 1, c: 1, e: 1 },
  c: { b: 1, f: 1 },
  d: { a: 1, e: 1, g: 1 },
  e: { b: 1, d: 1, f: 1, h: 1 },
  f: { c: 1, e: 1, i: 1 },
  g: { d: 1, h: 1 },
  h: { e: 1, g: 1, i: 1 },
  i: { f: 1, h: 1 },
};
const shortestPath = dijkstras.find_path(graph, "a", "i");
console.log("Shortest path:", shortestPath);

Contributing

We welcome contributions from the community to enhance Dijkstras. If you have ideas, bug reports, or feature requests, please open an issue on our GitHub repository at https://github.com/useCallback/dijkstras.

If you'd like to contribute code to the package, please follow these steps:

  1. Fork the repository on GitHub.

  2. Create a new branch for your feature or bug fix.

  3. Make your changes and include appropriate tests.

  4. Ensure that all tests pass by running the test suite.

  5. Commit your changes and push the branch to your fork.

  6. Open a pull request on the main repository, providing a detailed description of your changes.

License

Dijkstras is open source software released under the MIT License. You are free to use, modify, and distribute Dijkstras in accordance with the terms of the license.

Support

If you encounter any issues while using Dijkstras or have any questions, please contact me at [email protected]. We're here to help you!

Start finding the shortest paths with Dijkstras!