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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:34:08+00:00 2026-06-13T13:34:08+00:00

This is an implementation of Dijkstra algorithm. if Distance = Inf*ones(N,1) , what is

  • 0

This is an implementation of Dijkstra algorithm. if Distance = Inf*ones(N,1) , what is the value of Distance(CurrentNode)?? And could someone also give an example value of src and ConMat? Thank you!

while (nVisited <N)
   Visited(CurrentNode) = 1;
   for i=1:N
       if (ConMat(CurrentNode,i)>0)
           temp = ConMat(CurrentNode,i) + **Distance(CurrentNode)**;
           if (temp< Distance(i))
               Distance(i) = temp;
               PrevNode(i) = CurrentNode;
           end
       end
   end
  • 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-13T13:34:09+00:00Added an answer on June 13, 2026 at 1:34 pm

    Distance = Inf * ones(N,1) returns

    Inf
    Inf
    Inf
    
    ...
    Inf
    

    an array with size Nx1.


    CurrentNode contains the index of the vertice your algorithm is computing the path. Suppose you have a simple graph, such as the following (stolen from Wikipedia):

    enter image description here

    Your initial src is the node you start your search – in this case, index 1. For your initial node, Distance is 0. So, Distance( 1 ) = 0, while the others has Distance equals to Inf (Distance(src+1:end) = Inf).


    ConMat is your graph in a matrix representation.

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

Sidebar

Related Questions

How can i disable counting of deletion, in this implementation of Damerau-Levenshtein distance algorithm,
Can someone spot the problem with this implementation? I can open it up in
Can someone explain clearly why this implementation (from SO 3965054) of min_of_list works in
Let's take this implementation of Merge Sort as an example void mergesort(Item a[], int
Would you call this implementation of a multiton in objective-c 'elegant'? I have programmatically
Im looking at this implementation of DCT using cuda: http://www.cse.nd.edu/courses/cse60881/www/source_code/dct8x8/dct8x8_kernel1.cu The part in question
I wrote this implementation of the Sieve of Eratosthenes in c++, but whenever the
I have this implementation with fusion table layers where I try to use the
So i read a lot about why this implementation isn't thread-safe. But I didn't
In order to have list reordering functionality I turned to this implementation . My

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.