• (2 Pages)
  • +
  • 1
  • 2

Data Structures: Dijkstra's Algorithm Rate Topic: -----

#16 peterjdickson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-June 11

Posted 27 June 2011 - 11:21 AM

Verbatim! In the main do/while loop, the heap is growing by 2 every pass. Is it possible that the code posted online has a defect? Could you post your sample code you are running as a compressed attachment? Thanks!
Was This Post Helpful? 0
  • +
  • -

#17 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9025
  • View blog
  • Posts: 33,462
  • Joined: 27-December 08

Posted 27 June 2011 - 11:38 AM

My code is on my home computer. I'll check later tonight and see what's going on. It's possible I accidentally posted an old version, but I'm pretty sure this is the most recent one.
Was This Post Helpful? 0
  • +
  • -

#18 peterjdickson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-June 11

Posted 27 June 2011 - 12:07 PM

I'm fairly sure that the posted code doesn't have any support for detecting Vertexes (Connections) that have already been visited and it immediately get's into an inf-loop. I added support for marking Connections as having been visited and think I have a solution. I would be very interested in seeing yours to make sure I have optimized this. Thanks!
Was This Post Helpful? 0
  • +
  • -

#19 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9025
  • View blog
  • Posts: 33,462
  • Joined: 27-December 08

Posted 27 June 2011 - 02:24 PM

It looks like I made some changes to my Edge class in my Graphs tutorial for some other stuff I did. I updated it in my Graphs tutorial. Try again. You should be good to go. :)
Was This Post Helpful? 0
  • +
  • -

#20 kilroyreturns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-November 11

Posted 23 November 2011 - 09:45 PM

Sorry to bring this post back to life, but been looking over the code for a bit and been trying to figure this out. Is there any way for the program to return the path that was taken to the shortest root? For example if the command was

 test.heapPath(i, n);


to output: i,k.n = 11

Thank you for your help, and sorry
Was This Post Helpful? 0
  • +
  • -

#21 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9025
  • View blog
  • Posts: 33,462
  • Joined: 27-December 08

Posted 01 December 2011 - 07:53 PM

You could have an array of size V. Obviously the starting and ending points would be the first and last elements. But once you find the closest Vertex from the starting point, you would update the appropriate position in the array. Follow along this train of logic for each individual Vertex.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2