Skip to content

Commit

Permalink
update readme + add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
useCallback committed Aug 14, 2023
1 parent 55807eb commit 3447283
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 2,118 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- run: npm run build --if-present
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm test
- run: npm run build --if-present
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules/
dist/
.env
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
src/
scripts/
tsconfig.json
.github
.env
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

8 changes: 0 additions & 8 deletions CONTRIBUTING.md

This file was deleted.

19 changes: 0 additions & 19 deletions LICENSE.md

This file was deleted.

85 changes: 76 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,85 @@
# dijkstrajs.js
# Dijkstras

dijkstrajs is a simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
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.

The code was originally written by Wyatt Baldwin and turned into a node module by Thomas Cort.
## Installation

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

* [nodejs](http://nodejs.org/)
1. Ensure that you have Node.js installed on your system. You can download it from [https://nodejs.org](https://nodejs.org).

## Installation
2. Open your terminal or command prompt.

3. Navigate to your project directory.

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

```shell
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:
```typescript
import dijkstras from "dijkstras";
```
or :
```javascript
const dijkstras = require("dijkstras");
```
2. Create a graph and use the provided methods to find the shortest path:
```typescript
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](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

npm install dijkstrajs
Dijkstras is open source software released under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute Dijkstras in accordance with the terms of the license.

## Examples
## Support

See `test/dijkstra.test.js` in the sources for some example code.
If you encounter any issues while using Dijkstras or have any questions, please contact me at [[email protected]](mailto:[email protected]). We're here to help you!
Start finding the shortest paths with Dijkstras!
Loading

0 comments on commit 3447283

Please sign in to comment.