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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:24:45+00:00 2026-05-29T22:24:45+00:00

In Dijkstra’s algorithm what should I do if there are two or more nodes

  • 0

In Dijkstra’s algorithm what should I do if there are two or more nodes with minimal weights at a point in the algorithm?

In wikipedia: http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm at step no. 6, it says

“Set the unvisited node marked with the smallest tentative distance as the next ‘current node’ and go back to step 3.”

What if there are two or more nodes with “smallest tentative distance”.

Can anyone help me with the algorithm?

  • 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-29T22:24:46+00:00Added an answer on May 29, 2026 at 10:24 pm

    Short Answer

    Just pick either. Unless you have another heuristic to work with, you can’t tell which would be better to pick.


    Bit More Explaination

    Think about sorting some elements into an array:

    9 6 3 3 8
    

    sorted with lowest first is

    3 3 6 8 9
    

    If you were to query that array to determine the lowest, the answer is 3. Which 3 doesn’t matter.


    Similarly if you were to have some more information. Say for example that those ints were actually floats and were sorted by their integer parts. You might end up with the array:

    3.2  3.1  6.0  8.5  9.2
    

    Here you have another heuristic to work with, you can check the decimal part too, and you can determine that 3.1 is the lowest.

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

Sidebar

Related Questions

I am aware that Dijkstra's algorithm can find the minimum distance between two nodes
In graph theory, what is the distinction between minimal distance (which Dijkstra's algorithm finds),
I'm writing an application that uses Dijkstra algorithm to find minimal paths in the
Dijkstra's is typically used to find the shortest distance between two nodes in a
Can we use Dijkstra's algorithm with negative weights? STOP! Before you think lol nub
I am trying to understand why Dijkstra's algorithm will not work with negative weights.
Here's my interpretation of how Dijkstra's algorithm as described by wikipedia would deal with
I have set of nodes and edges and i used Dijkstra's algorithm to find
Is there a rgaph searching algorithm that searches through a graph (from point a
Dijkstra's Shunting Yard algorithm is used to parse an infix notation and generate RPN

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.