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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:23:42+00:00 2026-05-11T11:23:42+00:00

So, I have a simple pathfinding algorithm which precalculates the shortest route to several

  • 0

So, I have a simple pathfinding algorithm which precalculates the shortest route to several target endpoints, each of which has a different weight. This is somewhat equivalent to having one endpoint with a node between it and each endpoint, though the edges there have different weights. The algorithm it uses is a simple spreading algorithm, which in 1d looks this this (| means wall, – means space):

  • 5 - - - 3 | - - - 2 - - - - 2
  • 5 4 - - 3 | - - - 2 - - - - 2 : Handled distance 5 nodes
  • 5 4 3 - 3 | - - - 2 - - - - 2 : Handled distance 4 nodes
  • 5 4 3 2 3 | - - - 2 - - - - 2 : Handled distance 3 nodes
  • 5 4 3 2 3 | - - 1 2 1 - - 1 2 : Handled distance 2 nodes
  • Done. Any remaining rooms are unreachable.

So, let’s suppose I have a precalculated pathfinding solution like this one, where only the 5 is a target:

- - - - | 5 4 3 2 1 -

If I change the wall to a room. Recomputing is simple. Just re-handle all distance nodes (but ignore the ones which already exist). However, I am not able to figure out an efficient way to handle what to do if the 4 became a wall. Clearly the result is this:

- - - - | 5 | - - - -

However, in a 2d solution I’m not sure how to efficiently deal with 4. It is easily possible to store that 4 depends on 5 and thus needs recaculation, but how do I determine its new dependency and values safely? I’d rather avoid recalculating the entire array.

One solution, which is better than nothing, is (roughly) to only recalculate array elements with a manhattan distance of 5 from the 5, and to maintain source information. This would basically mean reapplying the algorithm to a selected area But can I do better?

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

    Hmmm. One solution I’ve come up with is this: Keep a list of nodes that are reachable most quickly from each node. If a node becomes a wall, check which node it was reachable from and grab the corresponding list. Then Recheck all those nodes using the standard algorithm. When reaching a node where the new distance is smaller, mark it as being in need of retesting.

    Take all the neighbors of the marked nodes which are unmarked and reapply the algorithm on them, ignoring any marked nodes that this technique hits. If the reapplied algorithm increases the value of a marked node, use the new value.

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

Sidebar

Related Questions

I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have simple SSIS package which reads data from flat file and insert into
I have simple SSIS package in which On Error event handler I have created
I have simple aspx page that has a form and a input field in
I have simple user registration form. In which i am puting city as a
I have simple front controller plugin which contains this code: http://pastebin.com/m155c59b0 When session expire
I have simple application with single AppDomain which is periodicaly launched on a server.
I have simple test project which creates a frame and adds one JTextPane to
Have simple C# console app which imports text data into SQL. It takes around
I have simple insert into.. query which is taking around 40 seconds to execute.

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.