SlideShare a Scribd company logo
POSCAT Seminar 10 :
Graph 3
yougatup @ POSCAT
1
Topic
 Topic today
− Minimum Spanning Tree
• Cut Property
• Prim Algorithm
• Kruskal Algorithm
POSCAT Seminar 1-2
16 July 2014
yougatup
Spanning Tree
 Definition
A tree which “spans” whole vertices
i.e. a tree with n vertices
POSCAT Seminar 1-3
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Spanning Tree
 Definition
A tree which “spans” whole vertices
i.e. a tree with n vertices
POSCAT Seminar 1-4
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Minimum Spanning Tree
 Problem
Find a spanning tree with minimum cost
POSCAT Seminar 1-5
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Minimum Spanning Tree
 Problem
Find a spanning tree with minimum cost
POSCAT Seminar 1-6
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Is it MST ?
Minimum Spanning Tree
 Problem
Find a spanning tree with minimum cost
POSCAT Seminar 1-7
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Is it MST ?
Cut Property
 Theorem
Suppose edge X are part of a MST of 𝐺 = (𝑉, 𝐸). Pick any subset of
nodes S for which X does not cross between S and 𝑉S, and let 𝑒
be the lightest edge across this partition. Then 𝑋 ∪ {𝑒} is part of
some MST
POSCAT Seminar 1-8
16 July 2014
yougatup
Proof ?
Cut Property
 Theorem
Suppose X is a set of edges which are part of a MST of 𝐺 = (𝑉, 𝐸).
Pick any subset of nodes S for which X does not cross between S
and 𝑉S, and let 𝑒 be the lightest edge across this partition. Then
𝑋 ∪ {𝑒} is part of some MST
POSCAT Seminar 1-9
16 July 2014
yougatup
Assume 𝑒 ∉ 𝑇. Then we can construct
a different MST 𝑇′ containing 𝑋 ∪ 𝑒
by altering T slightly.
Compare the cost(𝑇′) and cost (𝑇)
Cut Property
 Theorem
Suppose X is a set of edges which are part of a MST of 𝐺 = (𝑉, 𝐸).
Pick any subset of nodes S for which X does not cross between S
and 𝑉S, and let 𝑒 be the lightest edge across this partition. Then
𝑋 ∪ {𝑒} is part of some MST
POSCAT Seminar 1-10
16 July 2014
yougatup
by cut property, we can derive
beautiful greedy algorithm !
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-11
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-12
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-13
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-14
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-15
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-16
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-17
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
?
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-18
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
?
It make a cycle !
∴ we can’t select it
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-19
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-20
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-21
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-22
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-23
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Done ! we have no remaining edges
Kruskal Algorithm
 Approach
For each iteration, choose minimum edge which doesn’t make
a cycle. Then it will make a MST by cut property.
POSCAT Seminar 1-24
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Done ! we have no remaining edges
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?
POSCAT Seminar 1-25
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-26
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
If a edge connects two vertices with different group, it will never
make a cycle.
POSCAT Seminar 1-27
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
If not, it will make a cycle !
POSCAT Seminar 1-28
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-29
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1 2 3 4
5 6 7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-30
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1 2 3 4
5 6 7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-31
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1 23 4
5 6 7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-32
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1 23 4
5 6 7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-33
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3 4
5 6 7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-34
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3 4
5 6 7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-35
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3 4
5
6
7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-36
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3 4
5
6
7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-37
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4
5
6
7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-38
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4
5
6
7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-39
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4
5
6
7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-40
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4
5
6
7 8
No !!
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-41
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4
5
6
7 8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-42
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4 5
6 7
8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-43
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4 5
6 7
8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-44
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4 5
6 7
8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-45
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4 5
6 7
8
Kruskal Algorithm
 Question
How can we determine whether adding a edge makes a cycle or
not ?  by using Disjoint Set !
POSCAT Seminar 1-46
16 July 2014
yougatup
1 2
3
4
6
5
7
8
3
1 1
2 3
1 2
9
3
1
2
3
4 5
6 7
8
Kruskal Algorithm
 Implementation
− We have to sort the set of edges via their costs  with STL
− Union & Find
 Quite simple !
POSCAT Seminar 1-47
16 July 2014
yougatup
Kruskal Algorithm
 Implementation
− We have to sort the set of edges via their costs  with STL
− Union & Find
 Quite simple !
Analysis ?
POSCAT Seminar 1-48
16 July 2014
yougatup
Kruskal Algorithm
 Implementation
− We have to sort the set of edges via their costs  with STL
− Union & Find
 Quite simple !
Analysis ? Sorting takes O(𝐸 log 𝐸)
Each iteration takes almost O(1)
because we use Union & Find
POSCAT Seminar 1-49
16 July 2014
yougatup
Kruskal Algorithm
 Implementation
− We have to sort the set of edges via their costs  with STL
− Union & Find
 Quite simple !
Analysis ? Sorting takes O(𝐸 log 𝐸)
Each iteration takes almost O(1)
because we use Union & Find  O(𝑬 𝐥𝐨𝐠 𝑬 )
POSCAT Seminar 1-50
16 July 2014
yougatup

More Related Content

Viewers also liked

使ってわかる 今どきのdocker超入門
使ってわかる 今どきのdocker超入門使ってわかる 今どきのdocker超入門
使ってわかる 今どきのdocker超入門
Kazuhide Okamura
 
Jsp Notes
Jsp NotesJsp Notes
Jsp Notes
Rajiv Gupta
 
The Sapphire Bloc
The Sapphire BlocThe Sapphire Bloc
The Sapphire Bloc
The Ortigas Specialists
 
Bugatti Veyron
Bugatti VeyronBugatti Veyron
Bugatti Veyron
Xavier Merino
 
Bubble sorting lab manual
Bubble sorting lab manualBubble sorting lab manual
Bubble sorting lab manual
maamir farooq
 
Introduction to Polyhedral Compilation
Introduction to Polyhedral CompilationIntroduction to Polyhedral Compilation
Introduction to Polyhedral Compilation
Akihiro Hayashi
 
Risk Management Training 2013
Risk Management Training 2013Risk Management Training 2013
Risk Management Training 2013
Vicky Ames
 
EIA 2015 Wanted! ... An Inspiring and Relevant Travel Agency
EIA 2015 Wanted! ... An Inspiring and Relevant Travel AgencyEIA 2015 Wanted! ... An Inspiring and Relevant Travel Agency
EIA 2015 Wanted! ... An Inspiring and Relevant Travel Agency
European Innovation Academy
 
Hadoopことはじめ
HadoopことはじめHadoopことはじめ
Hadoopことはじめ
Katsunori Kanda
 
Elements of dynamic programming
Elements of dynamic programmingElements of dynamic programming
Elements of dynamic programming
Tafhim Islam
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
Mohammed Hussein
 
SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係
datastaxjp
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 
развитие памяти у детей дошкольного возраста посредством игр
развитие памяти у детей дошкольного возраста посредством игрразвитие памяти у детей дошкольного возраста посредством игр
развитие памяти у детей дошкольного возраста посредством игр
Ivushka98Sad
 
Commercial company brochure beglinwoods architects
Commercial company brochure beglinwoods architectsCommercial company brochure beglinwoods architects
Commercial company brochure beglinwoods architects
Simon Woods
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
Mumtaz Ali
 

Viewers also liked (17)

使ってわかる 今どきのdocker超入門
使ってわかる 今どきのdocker超入門使ってわかる 今どきのdocker超入門
使ってわかる 今どきのdocker超入門
 
Jsp Notes
Jsp NotesJsp Notes
Jsp Notes
 
The Sapphire Bloc
The Sapphire BlocThe Sapphire Bloc
The Sapphire Bloc
 
Bugatti Veyron
Bugatti VeyronBugatti Veyron
Bugatti Veyron
 
Bubble sorting lab manual
Bubble sorting lab manualBubble sorting lab manual
Bubble sorting lab manual
 
Introduction to Polyhedral Compilation
Introduction to Polyhedral CompilationIntroduction to Polyhedral Compilation
Introduction to Polyhedral Compilation
 
Risk Management Training 2013
Risk Management Training 2013Risk Management Training 2013
Risk Management Training 2013
 
EIA 2015 Wanted! ... An Inspiring and Relevant Travel Agency
EIA 2015 Wanted! ... An Inspiring and Relevant Travel AgencyEIA 2015 Wanted! ... An Inspiring and Relevant Travel Agency
EIA 2015 Wanted! ... An Inspiring and Relevant Travel Agency
 
Hadoopことはじめ
HadoopことはじめHadoopことはじめ
Hadoopことはじめ
 
Elements of dynamic programming
Elements of dynamic programmingElements of dynamic programming
Elements of dynamic programming
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
 
SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係SparkとCassandraの美味しい関係
SparkとCassandraの美味しい関係
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
развитие памяти у детей дошкольного возраста посредством игр
развитие памяти у детей дошкольного возраста посредством игрразвитие памяти у детей дошкольного возраста посредством игр
развитие памяти у детей дошкольного возраста посредством игр
 
Commercial company brochure beglinwoods architects
Commercial company brochure beglinwoods architectsCommercial company brochure beglinwoods architects
Commercial company brochure beglinwoods architects
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
 

Similar to Poscat seminar 11

Poscat seminar 7
Poscat seminar 7Poscat seminar 7
Poscat seminar 7
Hyungyu Shin
 
Poscat seminar 2
Poscat seminar 2Poscat seminar 2
Poscat seminar 2
Hyungyu Shin
 
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
DataStax
 
Andrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws - Final Project Report
Andrew Daws - Final Project Report
Andrew Daws
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
NETWAYS
 
Pivot Sampling in Dual-Pivot Quicksort
Pivot Sampling in Dual-Pivot QuicksortPivot Sampling in Dual-Pivot Quicksort
Pivot Sampling in Dual-Pivot Quicksort
Sebastian Wild
 
Stem Education - Screw
Stem Education - ScrewStem Education - Screw
Stem Education - Screw
Rokenbok Toy Company
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
Puppet
 
History of database monitoring
History of database monitoringHistory of database monitoring
History of database monitoring
Kyle Hailey
 
What Quantum Computing is and is not? - Manuel Rudolph, Physicist.
What Quantum Computing is and is not? - Manuel Rudolph, Physicist.What Quantum Computing is and is not? - Manuel Rudolph, Physicist.
What Quantum Computing is and is not? - Manuel Rudolph, Physicist.
Ari Massoudi
 
Rapid Prototyping of Dynamic Robots
Rapid Prototyping of Dynamic RobotsRapid Prototyping of Dynamic Robots
Rapid Prototyping of Dynamic Robots
Nick Morozovsky
 
Poscat seminar 3-1
Poscat seminar 3-1Poscat seminar 3-1
Poscat seminar 3-1
Hyungyu Shin
 
Prototyping Dynamic Robots
Prototyping Dynamic RobotsPrototyping Dynamic Robots
Prototyping Dynamic Robots
Nick Morozovsky
 
Stem Education - Wheel and Axle
Stem Education - Wheel and AxleStem Education - Wheel and Axle
Stem Education - Wheel and Axle
Rokenbok Toy Company
 
UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...
UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...
UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...
UKSG: connecting the knowledge community
 
Implementing the Split-Apply-Combine model in Clojure and Incanter
Implementing the Split-Apply-Combine model in Clojure and Incanter Implementing the Split-Apply-Combine model in Clojure and Incanter
Implementing the Split-Apply-Combine model in Clojure and Incanter
Tom Faulhaber
 
Dual-Pivot Quicksort - Asymmetries in Sorting
Dual-Pivot Quicksort - Asymmetries in SortingDual-Pivot Quicksort - Asymmetries in Sorting
Dual-Pivot Quicksort - Asymmetries in Sorting
Sebastian Wild
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
Scott Clark
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
SigOpt
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Codemotion
 

Similar to Poscat seminar 11 (20)

Poscat seminar 7
Poscat seminar 7Poscat seminar 7
Poscat seminar 7
 
Poscat seminar 2
Poscat seminar 2Poscat seminar 2
Poscat seminar 2
 
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
 
Andrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws - Final Project Report
Andrew Daws - Final Project Report
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
 
Pivot Sampling in Dual-Pivot Quicksort
Pivot Sampling in Dual-Pivot QuicksortPivot Sampling in Dual-Pivot Quicksort
Pivot Sampling in Dual-Pivot Quicksort
 
Stem Education - Screw
Stem Education - ScrewStem Education - Screw
Stem Education - Screw
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
 
History of database monitoring
History of database monitoringHistory of database monitoring
History of database monitoring
 
What Quantum Computing is and is not? - Manuel Rudolph, Physicist.
What Quantum Computing is and is not? - Manuel Rudolph, Physicist.What Quantum Computing is and is not? - Manuel Rudolph, Physicist.
What Quantum Computing is and is not? - Manuel Rudolph, Physicist.
 
Rapid Prototyping of Dynamic Robots
Rapid Prototyping of Dynamic RobotsRapid Prototyping of Dynamic Robots
Rapid Prototyping of Dynamic Robots
 
Poscat seminar 3-1
Poscat seminar 3-1Poscat seminar 3-1
Poscat seminar 3-1
 
Prototyping Dynamic Robots
Prototyping Dynamic RobotsPrototyping Dynamic Robots
Prototyping Dynamic Robots
 
Stem Education - Wheel and Axle
Stem Education - Wheel and AxleStem Education - Wheel and Axle
Stem Education - Wheel and Axle
 
UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...
UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...
UKSG Conference 2015 - E-resources: ezPAARSE helps you discover who is readin...
 
Implementing the Split-Apply-Combine model in Clojure and Incanter
Implementing the Split-Apply-Combine model in Clojure and Incanter Implementing the Split-Apply-Combine model in Clojure and Incanter
Implementing the Split-Apply-Combine model in Clojure and Incanter
 
Dual-Pivot Quicksort - Asymmetries in Sorting
Dual-Pivot Quicksort - Asymmetries in SortingDual-Pivot Quicksort - Asymmetries in Sorting
Dual-Pivot Quicksort - Asymmetries in Sorting
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 

Recently uploaded

Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 

Recently uploaded (20)

Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 

Poscat seminar 11

  • 1. POSCAT Seminar 10 : Graph 3 yougatup @ POSCAT 1
  • 2. Topic  Topic today − Minimum Spanning Tree • Cut Property • Prim Algorithm • Kruskal Algorithm POSCAT Seminar 1-2 16 July 2014 yougatup
  • 3. Spanning Tree  Definition A tree which “spans” whole vertices i.e. a tree with n vertices POSCAT Seminar 1-3 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 4. Spanning Tree  Definition A tree which “spans” whole vertices i.e. a tree with n vertices POSCAT Seminar 1-4 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 5. Minimum Spanning Tree  Problem Find a spanning tree with minimum cost POSCAT Seminar 1-5 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 6. Minimum Spanning Tree  Problem Find a spanning tree with minimum cost POSCAT Seminar 1-6 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 Is it MST ?
  • 7. Minimum Spanning Tree  Problem Find a spanning tree with minimum cost POSCAT Seminar 1-7 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 Is it MST ?
  • 8. Cut Property  Theorem Suppose edge X are part of a MST of 𝐺 = (𝑉, 𝐸). Pick any subset of nodes S for which X does not cross between S and 𝑉S, and let 𝑒 be the lightest edge across this partition. Then 𝑋 ∪ {𝑒} is part of some MST POSCAT Seminar 1-8 16 July 2014 yougatup Proof ?
  • 9. Cut Property  Theorem Suppose X is a set of edges which are part of a MST of 𝐺 = (𝑉, 𝐸). Pick any subset of nodes S for which X does not cross between S and 𝑉S, and let 𝑒 be the lightest edge across this partition. Then 𝑋 ∪ {𝑒} is part of some MST POSCAT Seminar 1-9 16 July 2014 yougatup Assume 𝑒 ∉ 𝑇. Then we can construct a different MST 𝑇′ containing 𝑋 ∪ 𝑒 by altering T slightly. Compare the cost(𝑇′) and cost (𝑇)
  • 10. Cut Property  Theorem Suppose X is a set of edges which are part of a MST of 𝐺 = (𝑉, 𝐸). Pick any subset of nodes S for which X does not cross between S and 𝑉S, and let 𝑒 be the lightest edge across this partition. Then 𝑋 ∪ {𝑒} is part of some MST POSCAT Seminar 1-10 16 July 2014 yougatup by cut property, we can derive beautiful greedy algorithm !
  • 11. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-11 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 12. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-12 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 13. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-13 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 14. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-14 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 15. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-15 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 16. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-16 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 17. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-17 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 ?
  • 18. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-18 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 ? It make a cycle ! ∴ we can’t select it
  • 19. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-19 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 20. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-20 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 21. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-21 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 22. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-22 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 23. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-23 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 Done ! we have no remaining edges
  • 24. Kruskal Algorithm  Approach For each iteration, choose minimum edge which doesn’t make a cycle. Then it will make a MST by cut property. POSCAT Seminar 1-24 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 Done ! we have no remaining edges
  • 25. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ? POSCAT Seminar 1-25 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 26. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-26 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 27. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! If a edge connects two vertices with different group, it will never make a cycle. POSCAT Seminar 1-27 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 28. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! If not, it will make a cycle ! POSCAT Seminar 1-28 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3
  • 29. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-29 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 30. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-30 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 31. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-31 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 23 4 5 6 7 8
  • 32. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-32 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 23 4 5 6 7 8
  • 33. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-33 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 34. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-34 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 35. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-35 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 36. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-36 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 37. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-37 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 38. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-38 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 39. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-39 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 40. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-40 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8 No !!
  • 41. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-41 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 42. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-42 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 43. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-43 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 44. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-44 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 45. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-45 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 46. Kruskal Algorithm  Question How can we determine whether adding a edge makes a cycle or not ?  by using Disjoint Set ! POSCAT Seminar 1-46 16 July 2014 yougatup 1 2 3 4 6 5 7 8 3 1 1 2 3 1 2 9 3 1 2 3 4 5 6 7 8
  • 47. Kruskal Algorithm  Implementation − We have to sort the set of edges via their costs  with STL − Union & Find  Quite simple ! POSCAT Seminar 1-47 16 July 2014 yougatup
  • 48. Kruskal Algorithm  Implementation − We have to sort the set of edges via their costs  with STL − Union & Find  Quite simple ! Analysis ? POSCAT Seminar 1-48 16 July 2014 yougatup
  • 49. Kruskal Algorithm  Implementation − We have to sort the set of edges via their costs  with STL − Union & Find  Quite simple ! Analysis ? Sorting takes O(𝐸 log 𝐸) Each iteration takes almost O(1) because we use Union & Find POSCAT Seminar 1-49 16 July 2014 yougatup
  • 50. Kruskal Algorithm  Implementation − We have to sort the set of edges via their costs  with STL − Union & Find  Quite simple ! Analysis ? Sorting takes O(𝐸 log 𝐸) Each iteration takes almost O(1) because we use Union & Find  O(𝑬 𝐥𝐨𝐠 𝑬 ) POSCAT Seminar 1-50 16 July 2014 yougatup