Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8075041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:51:33+00:00 2026-06-05T14:51:33+00:00

When you use A*, it chooses the best node which is the closest to

  • 0

When you use A*, it chooses the best node which is the closest to the goal right?
( using f(n) = g(n) + h(n))
( using Manhattan distance for h(n) )

But what if there are walls between the start and goal. I can’t explain it in words but I’ll show a picture.


(source: uploadir.com)

If A* chooses the node that is closest to the goal, why is the path not the one encircled in red? But the one encircled in green. I really don’t understand A* especially when there are impassable cells/tiles/nodes/etc. (walls). Also, you can see this picture I made like in this video http://www.youtube.com/watch?v=DINCL5cd_w0 (Path Finding Algorithms (A*, Dijkstra, Bi-Directional BFS)) at 1:20

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:51:35+00:00Added an answer on June 5, 2026 at 2:51 pm

    A* also considers the length of the current path as well as the distance to the goal. All possible paths are expanded, but with a priority on those which are:

    1. Closest to the goal
    2. Shortest

    The path cost, f(n) is equal to the cost at the previous step, g(n), plus a factor based on distance to the goal, h(n). So for every extra grid space the path goes through, the cost of the path increases. This will effectively create a balance between short paths, and paths which move directly to the goal.

    So by the time your example paths have joined up again, it is the purple path which is shortest, and so that will be the path which is expanded first, and will eventually reach the goal first.

    There is a Udacity course: Programming a Robotic Car which has a good section on the A* (and similar) algorithms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to let user choose what icon theme to use ,
I may not be asking this in the best way possible but i will
Are there any standard or best practice ways of limiting feature functionality for a
which is the best approach to include a static library with into an application
Im trying to choose the best server/client validation framework to use with my MVC
Is there a (best) way to check, if $uri was passed in single quotes?
I am still searching for the best solution howto use a layout with a
So many different controls to choose from! What are best practices for determining which
I am creating a tool which relies heavily on graph-node trees. The current implementation
I'm using popen to read output from shell commands. I will use fgets to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.