The NairaForum Community
May 24, 2012, 11:55:39 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Gallery Login Register  

Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: help with prims algorithm  (Read 435 times)
0 Members and 2 Guests are viewing this topic.
FemaleDuck 
New Naija
*

Karma: 0
Offline Offline

Posts: 9


« on: May 23, 2009, 04:18:48 AM »

I just want to make sure I understand prim's algorithm correctly

Given the graph with AB=3, BC=4, CD=4,AD=1,AE=7, CE=3,BE=6,AC=3. Show step by step how the algorithm finds the minimal spanning tree.

so lets say for argument sake that the start node is A. I have four choices. (A,B)(A,D)(A,E)(A,C). Since the shortest distance is (A,D) I choose that branch. Now I would see what the shortest distance from D is. I only have one choice which is (D,C) so I would then add that branch. Now from C I have to choices because (C,E)and (C,A) both have the same distance. However going to A would create a closed loop which is not allowed in a minimal spannng tree.

Am I on the right track? If not can someone please explain how to do this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Report to moderator   Logged

Pages: [1]   Go Up
  Send this topic  |  Print  

 
Jump to:  

Join Us On FaceBook and Twitter

Powered by MySQL Powered by PHP
Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
Valid XHTML 1.0! Valid CSS!