pathfinding-algorithms

1.0.11 • Public • Published

Pathfinding Algorithms

Hello there! This a package based on Javascript implementations of pathfinding algorithms we made as a part of our college project.

This can be used with any web application that requires any kind of maze solving or pathfinding in general, we've introduced DFS, BFS, Dijkstra and A* algorithms in the first publish.

How to use?

Step 1: Run npm install pathfinding-algorithms in the root directory.
Step 2: Import algorithms and use. That's it. See use cases.

Next steps

Import classes import {dfs, bfs, astar, dijkstra} from 'pathfinding-algorithms'

Running Algorithms for Pathfinding simulations

Arguments

  • grid: grid is a 2D array or array of arrays of object of prototype
    { weight: Number (for unweighted => put anything), isWall: Boolean }
  • start: String (`${start_cell_row}`_${start_cell_column})
  • end: String (`${end_cell_row}`_${end_cell_column})
function runBFS() { let bfsGrid = new bfs(start, end, grid); let { path, exploredNodes } = bfsGrid.startAlgorithm(); }

function runDFS() { let dfsGrid = new dfs(start, end, grid); let { path, exploredNodes } = dfsGrid.startAlgorithm(); }

function runDjikstra() { let djikstraGrid = new djikstra(start, end, grid); let { path, exploredNodes } = djikstraGrid.startAlgorithm(); }

function runAstar() { let astarGrid = new astar(start, end, grid); let { exploredNodes, path } = astarGrid.startAlgorithm(); }

Working on improving documentation...

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.11
    4
    • latest

Version History

Package Sidebar

Install

npm i pathfinding-algorithms

Weekly Downloads

4

Version

1.0.11

License

ISC

Unpacked Size

19.7 kB

Total Files

8

Last publish

Collaborators

  • samarthya
  • rohan_present