
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
astar-algorithm
Advanced tools
An almost universal implementation of A* search algorithm in JavaScript
An almost universal implementation of A* search algorithm in JavaScript
// 1) You need require the function
const astar = require('astar-algorithm')
// 2) You should define all callbacks
let callbacks = {
// It should return id / key / hash for a node
id(node) {
// return {String} or what you want
},
// It checks: is a node is the goal?
isGoal(node) {
// return {Boolean}
},
// It should return an array of successors / neighbors / children
getSuccessors(node) {
// return {Array} of nodes
},
// g(x). It returns the cost of path between two nodes
distance(nodeA, nodeB) {
// return {Number}
},
// h(x). It returns the cost of path from a node to the goal
estimate(node, goal) {
// return {Number}
}
}
// 3) Execute it!
let path = astar(start, goal, callbacks)
See examples there.
FAQs
An almost universal implementation of A* search algorithm in JavaScript
The npm package astar-algorithm receives a total of 1 weekly downloads. As such, astar-algorithm popularity was classified as not popular.
We found that astar-algorithm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.