{"id":15627714,"url":"https://github.com/fabienjuif/astar","last_synced_at":"2026-01-20T03:32:21.980Z","repository":{"id":40842180,"uuid":"250797615","full_name":"fabienjuif/astar","owner":"fabienjuif","description":"an A* algorithm in javascript","archived":false,"fork":false,"pushed_at":"2023-01-05T17:33:54.000Z","size":1316,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T12:42:02.333Z","etag":null,"topics":["a","algorithm","astar","game","path","shortest","shortest-path"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabienjuif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-28T13:08:02.000Z","updated_at":"2021-12-25T01:01:59.000Z","dependencies_parsed_at":"2023-02-04T08:45:17.714Z","dependency_job_id":null,"html_url":"https://github.com/fabienjuif/astar","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabienjuif%2Fastar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabienjuif%2Fastar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabienjuif%2Fastar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabienjuif%2Fastar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabienjuif","download_url":"https://codeload.github.com/fabienjuif/astar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569117,"owners_count":20959758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a","algorithm","astar","game","path","shortest","shortest-path"],"created_at":"2024-10-03T10:18:58.542Z","updated_at":"2026-01-20T03:32:21.951Z","avatar_url":"https://github.com/fabienjuif.png","language":"JavaScript","readme":"# @fabienjuif/astar\n\n\u003e an A\\* algorithm in javascript\n\n## Installation\n\n`npm install --save @fabienjuif/astar`\n\n## Usage\n\n```js\nconst getClosestPath = require('@fabienjuif/astar')\n\ngetClosestPath(\n  // array of rows that contains cells\n  graph,\n  // starting cell { x, y }\n  start,\n  // ending cell { x, y }\n  end,\n  // all the rest of parameters are **not required**\n  // but you can use them to tweak the engine\n  ({\n    // function to test two node are the same\n    sameNode = defaultSameNode,\n    // function that map the given graph to the one that the engine needs\n    mapGraph = identity,\n    // function to get neighbours of a cell (default works with squared cells)\n    getNeighbours = defaultGetNeighbours,\n    // function to get distance between 2 cells, default use pythagore (without the square root)\n    distance = defaultDistance,\n    // your heuristic\n    heuristic = () =\u003e 1,\n    // max loops before stoping the engine\n    maxLoops = Infinity,\n  } = {}),\n)\n```\n\n- Node are representated in object `x, y`\n- Graph is an array of cells\n\n\u003c!-- prettier-ignore --\u003e\n```js\nconst graph = [\n  // first line (x === 0)\n  [0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5],\n  // second line (x === 1)\n  [1, 0], [1, 1], [1, 2],\n  // third line (x === 2)\n  [2, 0], [2, 1], [2, 2], [2, 3],[2, 4],[2, 5],\n]\n\nconsole.log(graph[2][3])\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabienjuif%2Fastar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabienjuif%2Fastar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabienjuif%2Fastar/lists"}