pathfinding-algorithms

A package for implementing pathfinding algorithms for web apps that need some kind of path finding, maze solving. Supports both weighted and unweighted algos.

Usage no npm install needed!

<script type="module">
  import pathfindingAlgorithms from 'https://cdn.skypack.dev/pathfinding-algorithms';
</script>

README

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