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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer This error can happen if your web.config is not properly… May 11, 2026 at 3:51 pm
  • added an answer 1) Benefits. You didn't mentioned other options, but if you… May 11, 2026 at 3:51 pm
  • added an answer Anything that is specific to use within the IDE like… May 11, 2026 at 3:51 pm

Related Questions

I've got no experience with this, so i suspect my logic is overly complicated,
So I'm trying my hands at a css menu and I have a simple
So I have a simple validation rule pattern that I'm using to do validation
I have a simple extension method on the int type so I can do

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.