Skip to content
A* Search / Pathfinding Algorithm in Javascript
Find file
Pull request Compare This branch is 130 commits behind bgrins:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


javascript-astar: An implementation of the A* Search Algorithm in JavaScript
See a demo at

astar.js: The newest version of the algorithm using a Binary Heap.  It is quite faster than the original.
	Binary Heap taken from (license:
astar-list.js: The original version of the algorithm based off the original blog post at:
	I left it in because it may be a little easier for some people to understand, but if you were to use
	this in another application, I would strongly recommend using astar.js instead.
If you want just the A* search code (not the demo visualization), use code like this (

	<script type='text/javascript' src='graph.js'></script>
	<script type='text/javascript' src='astar.js'></script>
	<script type='text/javascript'>
		var graph = new Graph([
		var start = graph.nodes[0][0];
		var end = graph.nodes[1][2];
		var result =, start, end);
		// result is an array containing the shortest path

Something went wrong with that request. Please try again.