0 views

Uploaded by Enmusk

373

373

© All Rights Reserved

- Algebra I Notes Jan. 28
- GATE_CS-16_-SET-1b
- MTH202-FINAL TERM SOLVED MCQS.pdf
- questionbank-110202035041-phpapp01
- Measuring Price Dierences Across Countries and Time in the European Union
- 10.1.1.109.5296
- 1409fnyjurhz
- IITK-DS-CS210-2012
- Classifications of Ultrametric Spaces According to Roundness
- Kruskal algorithm
- Questions
- F10
- DFS
- Codes
- Formulas Ute Is
- 120 Guide to Greedy Algorithms
- [MECH-6] DETC2009-86845
- Data Structure
- LN 3 Greedy Technique(3)
- lecture24.ppt

You are on page 1of 52

Graph-Based Algorithms

CSE373: Design and Analysis of Algorithms

Definition of MST

• Let 𝐺 = (𝑉, 𝐸) be a connected, undirected graph.

• For each edge (𝑢, 𝑣) in 𝐸, we have a weight 𝑤(𝑢, 𝑣) specifying the

cost (length of edge) to connect 𝑢 and 𝑣.

• We wish to find a (acyclic) subset 𝑇 of 𝐸 that connects all of the

vertices in 𝑉 and whose total weight is minimized.

• Since the total weight is minimized, the subset 𝑇 must be acyclic

(no circuit).

• Thus, 𝑇 is a tree. We call it a spanning tree.

• The problem of determining the tree 𝑇 is called the minimum-

spanning-tree problem.

Application of MST

In the design of electronic circuitry, it is often necessary to make a set

of pins electrically equivalent by wiring them together.

To interconnect n pins, we can use n-1 wires, each connecting two

pins.

We want to minimize the total length of the wires.

Minimum Spanning Trees can be used to model this problem.

Application of MST

Problem: Laying Telephone Wire

Central office

Application of MST

Wiring: Naïve Approach

Central office

Expensive!

Application of MST

Wiring: Better Approach

Central office

Here is an example of a connected graph and its minimum

spanning tree:

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

replacing (b,c) with (a,h) yields another spanning tree with the same minimum weight.

Growing a MST(Generic Algorithm)

Set 𝐴 is always a subset of some minimum spanning tree. This

property is called the invariant Property.

An edge (𝑢, 𝑣) is a safe edge for 𝐴 if adding the edge to 𝐴 does not

destroy the invariant.

A safe edge is just the CORRECT edge to choose to add to T.

GENERIC_MST(G,w)

1 A=∅

2 while A does not form a spanning tree

3 find an edge (u,v) that is safe for A

4 A = A∪{(u,v)}

5 return A

How to Find a Safe Edge

We need some definitions and a theorem.

• A cut (𝑆, 𝑉 − 𝑆) of an undirected graph 𝐺 = (𝑉, 𝐸) is a

partition of 𝑉.

• An edge crosses the cut (𝑆, 𝑉 − 𝑆) if one of its

endpoints is in 𝑆 and the other is in 𝑉 − 𝑆.

• An edge is a light edge crossing a cut if its weight is the

minimum of any edge crossing the cut.

How to Find a Safe Edge

8 7

b c d 9

4

2

S↑ 11 14 e ↑S

a i 4

7 6

10

8

V-S↓ h g f ↓ V-S

1 2

• The edge (d,c) is the unique light edge crossing the cut.

The Algorithms of Kruskal and Prim

• The two algorithms are elaborations of the generic

algorithm.

• They each use a specific rule to determine a safe edge in

line 3 of GENERIC_MST.

• In Kruskal's algorithm,

• The set 𝐴 is a forest.

• The safe edge added to 𝐴 is always a least-weight edge in the

graph that connects two distinct components.

• In Prim's algorithm,

• The set 𝐴 forms a single tree.

• The safe edge added to 𝐴 is always a least-weight edge

connecting the tree to a vertex not in the tree.

Related Topics

Disjoint-Set (Chapter 21, Page 571)

• Keep a collection of sets S1, S2, .., Sk,

• Each Si is a set, e,g, S1={v1, v2, v8}.

• Three operations

• Make-Set(x) - creates a new set whose only member is x.

• Union(x, y) – unites the sets that contain x and y, say, Sx and Sy,

into a new set that is the union of the two sets.

• Find-Set(x) - returns a pointer to the representative of the set

containing x.

• Each operation takes O(log n) time.

Kruskal's Algorithm

MST_KRUSKAL(G,w)

1 𝐴=∅

2 for each vertex 𝑣 ∈ 𝐺. 𝑉

3 MAKE_SET(𝑣)

4 sort the edges of 𝐺. 𝐸 into nondecreasing order by weight 𝑤

5 for each edge 𝑢, 𝑣 ∈ 𝐺. 𝐸, taken in nondecreasing order by weight

6 if FIND_SET(𝑢) ≠ FIND_SET(𝑣)

7 𝐴 = 𝐴 ∪ {(𝑢, 𝑣)}

8 UNION(𝑢, 𝑣)

9 return 𝐴

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴=∅

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐 {𝑑} {𝑒} {𝑓} {𝑔} {ℎ} {𝑖}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴=∅

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐 {𝑑} {𝑒} {𝑓} {𝑔} {ℎ} {𝑖}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = {(𝑔, ℎ)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐 {𝑑} {𝑒} {𝑓} {𝑔, ℎ} {𝑖}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = {(𝑔, ℎ)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐 {𝑑} {𝑒} {𝑓} {𝑔, ℎ} {𝑖}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , (𝑐, 𝑖)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐, 𝑖 {𝑑} {𝑒} {𝑓} {𝑔, ℎ}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , (𝑐, 𝑖)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐, 𝑖 {𝑑} {𝑒} {𝑓} {𝑔, ℎ}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , (𝑓, 𝑔)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐, 𝑖 {𝑑} {𝑒} {𝑓, 𝑔, ℎ}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , (𝑓, 𝑔)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎 𝑏 𝑐, 𝑖 {𝑑} {𝑒} {𝑓, 𝑔, ℎ}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , (𝑎, 𝑏)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑖 {𝑑} {𝑒} {𝑓, 𝑔, ℎ}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , (𝑎, 𝑏)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑖 {𝑑} {𝑒} {𝑓, 𝑔, ℎ}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , (𝑐, 𝑓)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑓, 𝑔, ℎ, 𝑖 {𝑑} {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , (𝑐, 𝑓)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑓, 𝑔, ℎ, 𝑖 {𝑑} {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , (𝑐, 𝑓)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑓, 𝑔, ℎ, 𝑖 {𝑑} {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , (𝑐, 𝑑)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑑, 𝑓, 𝑔, ℎ, 𝑖 {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , (𝑐, 𝑑)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑑, 𝑓, 𝑔, ℎ, 𝑖 {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , (𝑐, 𝑑)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: 𝑎, 𝑏 𝑐, 𝑑, 𝑓, 𝑔, ℎ, 𝑖 {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , 𝑐, 𝑑 , (𝑎, ℎ)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: {𝑎, 𝑏, 𝑐, 𝑑, 𝑓, 𝑔, ℎ, 𝑖} {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , 𝑐, 𝑑 , (𝑎, ℎ)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: {𝑎, 𝑏, 𝑐, 𝑑, 𝑓, 𝑔, ℎ, 𝑖} {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , 𝑐, 𝑑 , (𝑎, ℎ)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: {𝑎, 𝑏, 𝑐, 𝑑, 𝑓, 𝑔, ℎ, 𝑖} {𝑒}

Kruskal's Algorithm: Example

•The edges are considered by the algorithm in sorted order by weight.

•The edge under consideration at each step is shown with a red

weight number.

8 7

b c d 9

4

2

a 11 14 e

i 4

7 6

10

8

h g f

1 2

Sorted edges: (g,h) (c,i) (f,g) (a,b) (c,f) (g,i) (c,d) (h,i) (a,h) (b,c) (d,e) (e,f) (b,h) (d,f)

𝐴 = { 𝑔, ℎ , 𝑐, 𝑖 , 𝑓, 𝑔 , 𝑎, 𝑏 , 𝑐, 𝑓 , 𝑐, 𝑑 , 𝑎, ℎ , (𝑑, 𝑒)}

𝑉𝑒𝑟𝑡𝑒𝑥 𝑠𝑒𝑡𝑠: {𝑎, 𝑏, 𝑐, 𝑑, 𝑒, 𝑓, 𝑔, ℎ, 𝑖}

Prim's Algorithm

MST_PRIM(G,w,r)

1 for each 𝑢 in 𝐺. 𝑉

2 𝑢. 𝑘𝑒𝑦 = ∞

3 𝑢. 𝜋 =NIL

4 𝑟. 𝑘𝑒𝑦 = 0

5 𝑄 = 𝐺. 𝑉 //Q is a min-priority queue

6 while 𝑄 ≠ ∅

7 𝑢 =EXTRACT_MIN(𝑄)

8 for each 𝑣 ∈ 𝐺. 𝐴𝑑𝑗[𝑢]

9 if 𝑣 ∈ 𝑄 and 𝑤 𝑢, 𝑣 < 𝑣. 𝑘𝑒𝑦

10 𝑣. 𝜋 = 𝑢

11 𝑣. 𝑘𝑒𝑦 = 𝑤(𝑢, 𝑣)

Prim's Algorithm: Example

the root 8 7

b c d

vertex 4 9

2

a 11 14 e

i 4

7 6

8 10

h g f

1 2

Prim's Algorithm: Example

8 7

b c d

4 9

∝/− 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

∝/− ∝/− ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

∝/− 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 ∝/− ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

∝/− 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 ∝/− ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

∝/− 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 ∝/− ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

∝/− 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 ∝/− ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

7/ℎ 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

7/ℎ 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ ∝/−

Prim's Algorithm: Example

8 7

b c d

4 9

6/𝑔 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

6/𝑔 2

a 11 14 e ∝/−

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

6/𝑔 2

a 11 14 e 10/𝑓

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

6/𝑔 2

a 11 14 e 10/𝑓

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

2/𝑐 2

a 11 14 e 10/𝑓

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

2/𝑐 2

a 11 14 e 10/𝑓

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

2/𝑐 2

a 11 14 e 10/𝑓

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

2/𝑐 2

a 11 14 e 9/𝑑

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

2/𝑐 2

a 11 14 e 9/𝑑

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

Prim's Algorithm: Example

8 7

b c d

4 9

2/𝑐 2

a 11 14 e 9/𝑑

i 4

0/− 7 6

8 10

h g f

1 2

8/𝑎 1/ℎ 2/𝑔

- Algebra I Notes Jan. 28Uploaded byrobin smith ccs
- GATE_CS-16_-SET-1bUploaded byShivansh Tomar
- MTH202-FINAL TERM SOLVED MCQS.pdfUploaded byMahreen Ilahi
- questionbank-110202035041-phpapp01Uploaded bylove kush
- 1409fnyjurhzUploaded byMohd Imtiaz
- Measuring Price Dierences Across Countries and Time in the European UnionUploaded byparthiban_vijayaragh
- IITK-DS-CS210-2012Uploaded byS Sai Krishna Prasad
- Classifications of Ultrametric Spaces According to RoundnessUploaded byBob Dylan
- 10.1.1.109.5296Uploaded byKak Long
- Kruskal algorithmUploaded byGowdham Prabhakar
- QuestionsUploaded byNikhil Patidar
- F10Uploaded byluci
- DFSUploaded bysonal
- CodesUploaded bySaurabh Kanojia
- Formulas Ute IsUploaded byGuilherme Ramos
- 120 Guide to Greedy AlgorithmsUploaded byGaurav Tripathi
- [MECH-6] DETC2009-86845Uploaded byElizabeth Rendon Velez
- Data StructureUploaded bysureshramaraj
- LN 3 Greedy Technique(3)Uploaded bypirtakoz
- lecture24.pptUploaded byAnonymous niE5VQOH
- DTMC Classification ReviewUploaded byJane Hanger
- Set2_transport & NetworksUploaded byDeepak Bujahi
- Gaussian Elimination of a 4x5 Matrix AUploaded byShahram Hawrami
- AVLTreeTutorialUploaded byyosua andreas aditya
- orUploaded byRatan Kamath
- Network AnalyticsUploaded byGanesh
- Using A* algorithm to find shortest path in Indoor positioning systemUploaded byIRJET Journal
- cpp codeUploaded byprashant_patel_mca
- S310-2012-lect10Uploaded byRachit Sharma
- 1sand2scomplement-110304214923-phpapp01Uploaded byjeams19011988

- List_of_vitamins.docUploaded byEnmusk
- Last ClassUploaded byEnmusk
- L16 Graph Part05Uploaded byEnmusk
- L14 Graph Part03Uploaded byEnmusk
- Lec 19 Diabetes, Lipid ProfileUploaded byEnmusk
- L09 DynamicProgramming_Part03Uploaded byEnmusk
- L13 Graph Part02Uploaded byEnmusk
- L12 Graph Part01Uploaded byEnmusk
- Lec 1,2 Intro to Biology and LifeUploaded byEnmusk
- L11 DynamicProgramming_Part05Uploaded byEnmusk
- L10 DynamicProgramming_Part04Uploaded byEnmusk
- L08 DynamicProgramming_Part02Uploaded byEnmusk
- L01 AlgoAnalysisUploaded byEnmusk
- L07 DynamicProgramming_Part01Uploaded byEnmusk
- L04 DivideConquer_Part03Uploaded byEnmusk
- L03 DivideConquer_Part02Uploaded byEnmusk
- L06 Greedy Part02Uploaded byEnmusk
- L05 Greedy Part01Uploaded byEnmusk
- L02 DivideConquer_Part01Uploaded byEnmusk
- 373 Assignment 1Uploaded byEnmusk
- Assignment 5CapacitorUploaded byEnmusk
- Lec 16 DigestionUploaded byEnmusk
- Lec 1,2,3 RMUploaded byEnmusk
- Lec 17 Circulatory SystemUploaded byEnmusk
- Lec 15 HomeostasisUploaded byEnmusk
- Lec 18 Respiratory, Excretory SystemUploaded byEnmusk
- Lec 3 Classification of Living ThingsUploaded byEnmusk
- Lec 4,5 Chemistry of LifeUploaded byEnmusk
- Lec 1,2,3 RM.pdfUploaded byEnmusk

- gnuradio tutorial 3Uploaded byTuan Do Trong
- CIT.pdfUploaded byPoornima Sridaran
- antcUploaded byRahil Andleeb
- Kevin Swingler- Lecture 4: Multi-Layer PerceptronsUploaded byRoots999
- ugc net exam Daa pdf fileUploaded byRamesh Kalia
- How to Implement the FFT Algorithm - CodeProjectUploaded byVegemboga
- Ch 2 optmizationUploaded byAiman Alammari
- Filters and Tuned amplifiersUploaded byHarsha
- Midterm 2011Uploaded byJose guiteerrz
- VC-SavageUploaded byishan_chawla123
- 1.2 Comparing Algorithms2Uploaded byiducduy
- Fundamentals os Signal ProcessingUploaded bySergio Ortega
- Ad 24210214Uploaded byAnonymous 7VPPkWS8O
- cs189 lecture 1Uploaded byYuhua Wang
- Newton-raphson vs BroydenUploaded bycorreita77
- IP CSE 205Uploaded byGautam Rajpal
- SC Question BankUploaded byraksha
- Mth603 FormulaeUploaded byAmir Saleem
- OpenCV Lections: 5. SmoothingUploaded byDenis Perevalov
- Matched FilterUploaded byahmednagia
- IEEE_2015-16_VLSIUploaded byTriple N Infotech
- Transportation Models MBA PPTUploaded byBabasab Patil (Karrisatte)
- Soft Input Viterbi DecoderUploaded bysurvivalofthepoly
- Chapter 14Uploaded byhonda7096
- Comparison of Feature selection methods for diagnosis of cervical cancer using SVM classifierUploaded byAnonymous 7VPPkWS8O
- M.Tech. Design & Simulation Lab Manual - II.pdfUploaded byAnkita Bharti
- Midterm 2 SolutionUploaded byvirjog
- Numerical MethodsUploaded byhaithamelramlawi7503
- Discrete Cosine Transform and JPEG FilesUploaded byAmber Habib
- Mathcad_-_Truss2D1Uploaded byYam Balaoing