Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-star

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-star

Generic A* algorithm

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
511
decreased by-11.44%
Maintainers
1
Weekly downloads
 
Created
Source

a-star

Generic A* algorithm.

Usage

var aStar = require('a-star');
// if this is going to take a while you may want to child_process.fork
// and pass the results to the parent process
// see below for options
var path = aStar(options);
console.log(path);

Documentation

astar(options)

Return Value

Returns an array of nodes including start and end, or null if no path is found.

options accepted

  • start - the start node
  • isEnd - function(node) that returns whether a node is an acceptable end
  • neighbor - function(node) that returns an array of neighbors for a node
  • distance - function(a, b) that returns the distance cost between two nodes
  • heuristic - function(node) that returns a heuristic guess of the cost from node to an end.
  • hash - function(node) that returns a unique string for a node. this is so that we can put nodes in heap and set data structures which are based on plain old JavaScript objects. Defaults to using node.toString.
  • timeout - optional limit to amount of milliseconds to search before returning null.

The data type for nodes is unrestricted.

FAQs

Package last updated on 13 Jan 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc