Difference between the Minimum spanning tree (MST) and the Shortest path tree
Difference between the Minimum spanning tree (MST) and the Shortest path
Minimum spanning tree(MST) |
Shortest path tree |
Ini MSTi therei isi noi sourcei andi noi destination,i buti iti isi thei subseti (tree)i ofi thei graph(G)i whichi connectsi alli thei verticesi ofi thei graphi Gi withouti anyi cyclesi andi thei minimumi possiblei totali edgei weight. |
Therei isi ai sourcei andi destination,i andi onei needi toi findi outi thei shortesti pathi betweeni them |
Graphi (G)i shouldi bei connected,i undirected,i edge-weighted,i labeled. |
Iti isi noti necessaryi fori thei Graphi (G)i toi bei connected,i undirected,i edge-weighted,i labeled. |
Herei relaxationi ofi edgesi isi noti performedi buti herei thei minimumi edgei weighti isi choseni onei byi onei fromi thei seti ofi alli edgei weightsi (sortedi accordingi toi mini weight)i andi thei treei isi formedi byi themi (i.e.i therei shouldi noti bei anyi cycle). |
Herei thei relaxationi ofi edgesi isi performed. ·
Herei d(U)i meansi thei distancei ofi sourcei vertexi Si toi vertexi wherei C(U,i V)i isi thei distancei betweeni Ui andi V. ·
Ifi d(U)i >i d(V)i +i C(U,i V)i theni d(U)i =i d(V)i +i C(U,i V). ·
Fori example,i 20>10+5,i d(U)i =i 15,i isi thei minimumi distancei fromi sourcei vertexi Si toi vertexi U. ·
Therefore,i relaxationi isi performed. |
Ini thisi case,i ai Minimum
spanning tree cani bei formedi buti negativei weightsi edgei cyclesi arei
noti generallyi used.i Usingi thei
cyclei propertyi ofi
MST,i thei minimumi edgei weighti amongi alli
thei edgei weightsi ini thei
negativei edgei cyclei cani bei
selected. |
Ifi thei graphi isi connected,i andi ifi ai negativei weighti edgei cyclei presenti ini thei graph.i Theni thei shortesti pathi cani noti bei computed,i buti thei negativei edgei cyclei cani bei detectedi usingi thei Bellman-Fordi
algorithm. |
Ini thei casei ofi ai disconnected graph, thei Minimum
spanning tree cani noti bei
formedi buti manyi spanning-treei forestsi cani bei
formed. |
Ini thei casei ofi ai disconnectedi
graph,i thei distancei betweeni twoi verticesi presenti ini twoi differenti componentsi isi infinity. |
Herei thei Greedy approach isi usedi fori findingi MSTi fori ai graph,i Fori example,i Prim’s algorithm andi Kruskal’s algorithm. |
·
Thei Dijkstra’s
algorithm basedi oni thei Greedy
approach andi Bellmani
fordi basedi oni Dynamici
programmingi arei generallyi usedi fori findingi thei single-sourcei shortesti paths. ·
Floyd-Wari
shalli algorithm basedi oni thei Dynamici
programmingi isi usedi fori findingi alli
pairsi thei shortest
path. |
Ifi therei arei Ni verticesi arei presenti insidei graphi Gi theni thei Minimum spanning tree ofi thei
graphi willi containi N-1i edgesi andi Ni vertices. |
Ifi therei arei Ni verticesi presenti insidei graphi G,i theni ini thei shortesti pathi betweeni twoi verticesi therei cani bei ati mosti N-1i edges,i andi ati mosti Ni verticesi cani bei presenti ini thei shortesti path. |
Iti isi usedi ini networki designi (computeri networks,i telecommunicationi networks,i wateri supplyi networks)i andi ini circuiti designi applications,i andi manyi more. |
Iti isi usedi toi findi outi directioni betweeni physicali locationsi likei ini Googlei Maps. |