Kruskal's Algorithm: Minimum Spanning Tree (MST)

  Рет қаралды 292,661

EducateYourself

EducateYourself

Күн бұрын

Example of Kruskal's algorithm

Пікірлер: 100
@countchungalitus7604
@countchungalitus7604 2 жыл бұрын
Studying for my data structures exam that is in... four hours. Your videos on Kruskals, Prims, and Dijkstra's are saving my life because I missed those lectures. Cheers mate!
@monaami555
@monaami555 7 жыл бұрын
"the main thing is, you can't have any psychos" - agree!
@hdjksa52
@hdjksa52 7 жыл бұрын
LOL........ I am latin and members of my family speak with an accent.
@user-rf4vc7mt4d
@user-rf4vc7mt4d 3 жыл бұрын
SCAM
@amrahmed7856
@amrahmed7856 4 ай бұрын
He means *_cycles_*
@Alkis05
@Alkis05 3 жыл бұрын
One improvement I would make would be this: When choosing between two edges with the same weight, choose randomly between them, but give a probability weighted by the degree of the node you are connecting to. In many real life networks, nodes with high degree tend to receive more new nodes than less connected nodes.
@dedel0810
@dedel0810 4 жыл бұрын
I thought it was my laptop's fan that sounds so loud when i listened to the audio. I panicked for a sec. But thanks! This really helped a lot!
@MuhidAbid14point75
@MuhidAbid14point75 3 жыл бұрын
Again, short and simple to the point great video.
@jacopomaccari4086
@jacopomaccari4086 4 жыл бұрын
bro just increase the thickness of the pen 😂😂
@EducateYourselfNow
@EducateYourselfNow 4 жыл бұрын
very good point
@anoriginalnick
@anoriginalnick 3 жыл бұрын
He did but the brush size stays the same 😭
@tamersahin5189
@tamersahin5189 4 жыл бұрын
THIS VIDEO IS JUST 🔥🔥🔥🔥 THX A LOT MAN!!!!!
@gongjiaji2489
@gongjiaji2489 6 жыл бұрын
thank you very much, i have exam tomorrow
@EducateYourselfNow
@EducateYourselfNow 6 жыл бұрын
good luck!
@christoforoslapathiotis8064
@christoforoslapathiotis8064 3 жыл бұрын
so how did it go?
@sakethcherukuri277
@sakethcherukuri277 3 жыл бұрын
@@christoforoslapathiotis8064 some of lifes greatest mysteries. we may never know!
@097_zarb2
@097_zarb2 4 ай бұрын
Pretty good​@@christoforoslapathiotis8064
@sirch1984
@sirch1984 7 жыл бұрын
Thanks for helping me with my hw, you rock my dude
@EducateYourselfNow
@EducateYourselfNow 7 жыл бұрын
I am glad I can help
@JoseSanchez-vv1zd
@JoseSanchez-vv1zd 6 жыл бұрын
Nice explanation. Thank you.
@iffatsarfraz5145
@iffatsarfraz5145 6 жыл бұрын
I agree. Thank you so much for posting this video!
@orangutan79
@orangutan79 6 жыл бұрын
if you also circle the vertices you've visited red, choosing the next edge/vertex pair will become easier without having to look through the entire graph to check for a cycle
@EducateYourselfNow
@EducateYourselfNow 6 жыл бұрын
that is true, didn't think of that, thank you. i ll incorporate that in my upcoming videos
@ZapOKill
@ZapOKill 2 жыл бұрын
thats not correct. 3:00 would fail. you have to maintain a en.wikipedia.org/wiki/Disjoint-set_data_structure
@unknownplayer0383
@unknownplayer0383 4 жыл бұрын
dope !!!!! thanks for this video. you just did 10 times better than my professor at cal state Monterey Bay
@andreicusnir4320
@andreicusnir4320 7 жыл бұрын
very nice explained video! Thank you
@EducateYourselfNow
@EducateYourselfNow 7 жыл бұрын
Thank you Andrei :)
@xxakhilh47xx41
@xxakhilh47xx41 3 ай бұрын
Lifesaver
@wachowski9525
@wachowski9525 2 жыл бұрын
what a king, ty
@nashb9691
@nashb9691 7 жыл бұрын
Dude i love you man
@EducateYourselfNow
@EducateYourselfNow 7 жыл бұрын
thank you brother, i appreciate the love :)
@JC-cu2ym
@JC-cu2ym 4 жыл бұрын
THANKS FOR SAVING MY LIFE :D !!!!
@amiraayedi
@amiraayedi 4 ай бұрын
Thank you for this!! (you have a nice voice though god)
@sanjeewankulathunga
@sanjeewankulathunga 5 жыл бұрын
i have exam tomorrow thanks man i got it
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
i hope you did well :)
@nooranalkhateeb8481
@nooranalkhateeb8481 Жыл бұрын
the path you choose is not the shortest path
@sanket_valani
@sanket_valani 5 жыл бұрын
Nice work man :)
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
thank you :)
@zepheriah5294
@zepheriah5294 6 жыл бұрын
You said that since you decided to pick the edge with amount 8 from B - C, you couldn't pick the edge amount with 8 also from A - H because it wasn't a part of the same tree. Why is that? I thought all of the vertices were in one tree? What is the criteria on that?
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
The reason why we can't choose a-h after choosing b-c is because it would form a cycle. Yet if we have chosen a-h instead of b-c, we would have a different resulting MST. You can have multiple MST from a single graph.
@zepheriah5294
@zepheriah5294 5 жыл бұрын
@@EducateYourselfNow Duh! Thank you!
@tanss6467
@tanss6467 Жыл бұрын
Good video, help me a lot
@sirisunkam6011
@sirisunkam6011 6 жыл бұрын
U r explanation too gud...pls explain bellmanford algorithm also....
@EducateYourselfNow
@EducateYourselfNow 6 жыл бұрын
i will upload it soon
@eyyys1342
@eyyys1342 4 жыл бұрын
THANK U SO MUCH FOR THIS
@bennybob444
@bennybob444 6 жыл бұрын
Given completely distinct edges in graph G, there is only a single MST.
@badboybs98
@badboybs98 2 жыл бұрын
Given a graph G lets prove this by contradiction: G has two MST A,B. A has an edge e that B does not If we add that edge to B then there is a cycle. However, k. Algo would have picked the edge e0 over e therefore, A must not be in mst.
@mikewong5859
@mikewong5859 5 жыл бұрын
Pretty nice, thanks.
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
thank you :)
@norueljayvillas5780
@norueljayvillas5780 5 жыл бұрын
so it means that the objective of this algorithm is to find the lowest edge-weights? and then it should start also in the lowest number of weights? thanks sir, btw you did a great job, i',m just a little bit confused because i don't know the rules of this algorithm.
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
well to find the minimum cost edges, which would eventually result mst. its a greedy algorithm, it doesn't necessarily start at the lowest number of weights but it will find them. and thank you sir
@Poojasahani12356
@Poojasahani12356 4 жыл бұрын
Awesome sir😍😍
@ifzahmed3973
@ifzahmed3973 7 жыл бұрын
Thanks bro
@monilparekh3972
@monilparekh3972 5 жыл бұрын
1. how does adding edge (b,h) with edge weight 11 form a cycle? 2. adding (c,i) and (g,f) with edge weight 2 is fine but adding (b,c) and (a,h) with edge weight 8 is a problem. can you elaborate?
@Koo998_
@Koo998_ 5 жыл бұрын
1. with (b,h), it will loop the diagram. This means you will be creating a cycle where it goes from b, h, g, f, c, b. You do not want the arc/edge to be in a cycle (loop). Not connecting (b,h) means that there is no loop created. 2. Adding (c,i) and (g,f) is fine because they will not create a cycle, so you pick both. (b,c) and (a,h) is only a problem because you can not pick both as that will create a loop/cycle. But he states that you can pick either one as either (b,c) or (a,h) as there will sometimes be multiple minimum spanning trees (alternative paths).
@ahmedmagdy-qg3tb
@ahmedmagdy-qg3tb 5 жыл бұрын
good job
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
thank you!
@jahanzaibasgher1275
@jahanzaibasgher1275 6 жыл бұрын
thank you
@mojtabavatandost3982
@mojtabavatandost3982 5 жыл бұрын
thanks
@simonhrabec9973
@simonhrabec9973 4 жыл бұрын
Ok, how do we get the lowest weighted edges? How do we find if adding an edge would form a cycle? Isnt explaining this the point of these videos?
@mahdiebrahimi1662
@mahdiebrahimi1662 4 жыл бұрын
Thank you so much! XD
@HauNguyen-mb3si
@HauNguyen-mb3si 6 жыл бұрын
Thanks
@WoosTV
@WoosTV 6 жыл бұрын
thx bro
@prvizpirizaditweb2324
@prvizpirizaditweb2324 Жыл бұрын
why did not you choose both edges with weight 8?
@cutething4910
@cutething4910 5 жыл бұрын
Thank u sir
@Github_tech_with_ty
@Github_tech_with_ty 4 жыл бұрын
Can someone explain what he mains by cycle more?
@caparn100
@caparn100 4 жыл бұрын
How do you programmatically test if adding the edge will form a cycle?
@aurbakhan1019
@aurbakhan1019 7 жыл бұрын
can anyone explain why did not we consider the other 8
@EducateYourselfNow
@EducateYourselfNow 7 жыл бұрын
we could, it wouldn't have mattered. I think i mentioned it in the video. 3:07
@MsKevkev1234
@MsKevkev1234 7 жыл бұрын
if he did it would form a loop abcfgha
@cameronfitzpatrick2489
@cameronfitzpatrick2489 6 жыл бұрын
either way forms a mst - mst is not necessarily unique
@samailotoke7201
@samailotoke7201 2 жыл бұрын
Is this the same as minimum cost arborescence?
@halcy6422
@halcy6422 4 жыл бұрын
well you could remove the c-d, and replace it with e-f. i think it will produce better MST
@sky76570
@sky76570 5 жыл бұрын
In the Time Complexity part, you definitely gave a description of the runtime of the Prim's algorithm, not Kruskal's.
@i0dan
@i0dan 3 жыл бұрын
BIG O!
@mohdalnokhatha521
@mohdalnokhatha521 5 жыл бұрын
thanks a lot man its very helpful answer is 42 ??
@marieselfer6621
@marieselfer6621 4 жыл бұрын
Isn't it 37?
@tiberiunaznean7155
@tiberiunaznean7155 4 жыл бұрын
@@marieselfer6621 i think its 37 too
@BradleyLillian-n9h
@BradleyLillian-n9h 19 күн бұрын
Hannah Lodge
@Turkeys_VR
@Turkeys_VR 6 жыл бұрын
It looks like C would form a cycle. Am I missing something?
@EducateYourselfNow
@EducateYourselfNow 6 жыл бұрын
there is no loop that encloses c
@ffs0
@ffs0 4 жыл бұрын
Dikjstra algo??
@azzahrahumaira6955
@azzahrahumaira6955 5 жыл бұрын
if we have touched all the vertices but not all the edges yet what should i do? finish all the edges?
@EducateYourselfNow
@EducateYourselfNow 5 жыл бұрын
yes
@Chandler890
@Chandler890 7 жыл бұрын
so whats difference btw prims
@EducateYourselfNow
@EducateYourselfNow 7 жыл бұрын
at a very high level, prims algorithms graph has to be connected, kruskals doesn't, in kruskals, you look at the next globally least costly edge where in prims you look at all edges from the current component to other vertices and find the smallest among them.
@dabluedevil1000
@dabluedevil1000 6 жыл бұрын
How would choosing the edges "bh" create a cycle?
@EducateYourselfNow
@EducateYourselfNow 6 жыл бұрын
cycle would be : b c f g h, or b h g f c
@aldrinebarit3961
@aldrinebarit3961 3 жыл бұрын
how do you get those numbers?
@TheBobby570
@TheBobby570 7 жыл бұрын
EE241C5A ftw!!!
@muhammadazfar97
@muhammadazfar97 3 жыл бұрын
Can't understand about algorithm
@almuntasirabir4511
@almuntasirabir4511 7 жыл бұрын
why did you choose both the two
@EducateYourselfNow
@EducateYourselfNow 7 жыл бұрын
because the next two was the lowest costly edge, it doesn't matter how many of the same numbers you have, as long as it doesn't create a cycle, you can choose it.
@almuntasirabir4511
@almuntasirabir4511 7 жыл бұрын
thanks
@niklaspeura4193
@niklaspeura4193 6 жыл бұрын
But is it still minimal is the question.
@kma1138
@kma1138 6 жыл бұрын
@xiangzuo1306
@xiangzuo1306 6 жыл бұрын
u such a copy ninja (from book introduction of algorithm)
@Bleachiiigo
@Bleachiiigo 4 жыл бұрын
I hate discreet mathmatcis
3.5 Prims and Kruskals Algorithms - Greedy Method
20:12
Abdul Bari
Рет қаралды 2,8 МЛН
Prim's Algorithm: Minimum Spanning Tree (MST)
6:14
EducateYourself
Рет қаралды 463 М.
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 107 МЛН
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 5 МЛН
Union Find Kruskal's Algorithm
6:15
WilliamFiset
Рет қаралды 204 М.
12. Greedy Algorithms: Minimum Spanning Tree
1:22:10
MIT OpenCourseWare
Рет қаралды 225 М.
Minecraft images but it's incredibly terrifying.
8:20
Phoenix SC
Рет қаралды 655 М.
Dijkstra's Algorithm: Shortest Path
5:10
EducateYourself
Рет қаралды 69 М.
How Do You Calculate a Minimum Spanning Tree?
11:12
Spanning Tree
Рет қаралды 55 М.
Kruskal's Algorithm for Minimum Spanning Trees (MST) | Graph Theory
5:50
Minecraft's New Horror Features are Already Here
9:58
Knarfy Too
Рет қаралды 232 М.
Network problems. Part 2. Minimal spanning tree.
4:45
Айза Замирбек кызы
Рет қаралды 9 М.
Prim's Minimum Spanning Tree Algorithm | Graph Theory
14:53
WilliamFiset
Рет қаралды 120 М.
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 107 МЛН