Algorithms For Dummies


Testing Kruskal’s algorithm



Download 7,18 Mb.
Pdf ko'rish
bet331/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   327   328   329   330   331   332   333   334   ...   651
Bog'liq
Algorithms

Testing Kruskal’s algorithm

Kruskal’s algorithm uses a greedy strategy, just as Prim’s does, but it picks the 

shortest edges from a global pool containing all the edges (whereas Prim’s evalu-

ates the edges according to the vertexes in the spanning tree). To determine 

whether an edge is a suitable part of the solution, the algorithm relies on an 

aggregative process in which it gathers vertexes together. When an edge involves 

vertexes already in the solution, the algorithm discards it to avoid creating a cycle. 

The algorithm proceeds in the following fashion:

1. 

Put all the edges into a heap and sort them so that the shortest edges are on top.



2. 

Create a set of trees, each one containing only one vertex (so that the number 

of trees is the same number as the vertexes). You connect trees as an aggre-

gate until the trees converge into a unique tree of minimal length that spans all 

the vertexes.

3. 


Repeat the following operations until the solution doesn’t contain as many 

edges as the number of vertexes in the graph:




Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   327   328   329   330   331   332   333   334   ...   651




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish