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 4030040
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:25:17+00:00 2026-05-20T11:25:17+00:00

In A* usually the result that you get is only one path. Is it

  • 0

In A* usually the result that you get is only one path. Is it possible though for a given origin and destination to have 3 recommended path according to A*? So the second returned is the second best path, and the third is the third best path..

I was thinking of maybe modifying the heuristic somehow to reflect this second and third best path.. What do you guys think?

UPDATE:
My implementation is in PHP and I am using a closed set. So if there’s a way to do this, let me know.

  • 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-05-20T11:25:18+00:00Added an answer on May 20, 2026 at 11:25 am

    This can be done quite easily if your language has support for backtracking/generators/iterators/coroutines.

    # Python code
    def astar(start):
        q = [start]    # priority queue
        while len(q) > 0:
            node = heappop(q)
            if isGoal(node):
                yield node
            for x in successors(node):
                heappush(q, x)
    

    The yield keyword is similar to return, except that the function may be re-entered after a yield to get the next solution. To get the best three:

    solutions = []
    i = 0
    for sol in astar(start):
        solutions.append(sol)
        if i == 3:
            break
        i += 1
    

    However, this will not work if you use a closed set (i.e., Russell & Norvig‘s graph search algorithm), since then part of the non-optimal solutions may be “cut off” when searching for the optimal one.

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

Sidebar

Related Questions

I have about thirty strings that get passed to my stored procedure which act
Usually when I build a site, I put all the CSS into one file,
Usually when defining a DAO, you would have a setter for the datasource on
I'm doing video analysis. The end result array I get is something like: signal
I have an n-partite (undirected) graph, given as an adjacency matrix, for instance this
I have a request for a contracting gig and one of the requirements in
How do I call Class.forName() when the result is a generic type? Usually I
I have a website that basically allows customers to build a cart with an
I have a php / mysql / jquery web app that makes 13 ajax
The problem I just accidentally committed a change to a file that was only

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.