Link to home
Start Free TrialLog in
Avatar of mustish1
mustish1

asked on

Prims and Kruskals algorithm

Hi guys: I give the name on each vertax a,b,c,d,e,f,g,h. Can any one please tell me how to find a minimal spanning tree and compute its total weight on this diagram?

Thanks.

qq2.jpg
Avatar of Member_2_276102
Member_2_276102

Edges cd and ce have no weights that I can see. Is that intended or does it indicate zero or 'unknown'? Is fh weighted 5 or 8? (I can't quite decide.)

Tom
Avatar of mustish1

ASKER

sorry
fh=5
cd=2
ce=8
ASKER CERTIFIED SOLUTION
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i want to do b ymyself. please let me know if i go wrong
BC is the shortest arc with length 1.

so now BA and BE
BE is the shortest arc with length 2.

so now AC and AD
AD is the shortest arc with length 1.

AC create loop or circuit so we cant use it.

am i doing right?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
so now DG and DF
DG is the shortest arc with length 8

DF is the shortest arc with length 7

EF is the shortest arc with length 3
FH is the shortest arc with length 5
GH is the shortest arc with length 6

I THINK REST OF THEM CREATE CIRCUIT

ONE MORE

DC is the shortest arc with length 2
Can experts please tell me if i did right
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
is this is correct?
No you still have loops. I gave you the solution above in #37228420
Can you see why if you draw it?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

An easier to visualize example. User generated image
> I gave you the solution above in #37228420

Why you start with 3 instead of 1 ?
Avatar of phoffric
Actually you can start with any vertex. But, it is possible that when starting from different vertices, you will get multiple solutions all having the same minimum value.