15.082 and 6.855j

32
1 15.082 and 6.855J Spanning Tree Algorithms

Upload: debra-joseph

Post on 31-Dec-2015

15 views

Category:

Documents


0 download

DESCRIPTION

15.082 and 6.855J. Spanning Tree Algorithms. 10. 8. 2. 4. 6. 35. 15. 1. 25. 20. 30. 17. 21. 40. 3. 5. 7. 15. 11. The Greedy Algorithm in Action. 4. 2. 6. 1. 5. 3. 7. The Greedy Algorithm in Action. 10. 10. 8. 8. 2. 4. 6. 4. 2. 6. 35. 35. 15. 15. 1. 1. - PowerPoint PPT Presentation

TRANSCRIPT

1

15.082 and 6.855J

Spanning Tree Algorithms

2

The Greedy Algorithm in Action

1

2

3

4

5

6

7

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

3

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

4

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

5

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

6

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

7

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

8

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

9

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

10

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

11

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

12

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

13

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

14

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

Node 1 2 3 4 5 6 7

First 1 2 3 4 5 4 7

35

10

30

15

25

40

20 17

8

15

11

211

2

3 5 7

root node

4 66

15

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

Node 1 2 3 4 5 6 7

First 1 4 3 4 5 4 7

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

7

2

16

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

Node 1 2 3 4 5 6 7

First 1 4 3 4 5 4 5

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

77

17

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

Node 1 2 3 4 5 6 7

First 1 4 5 4 5 4 5

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

773

18

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

Node 1 2 3 4 5 6 7

First 1 4 4 4 4 4 4

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

75 73 5 73

19

The Greedy Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

Node 1 2 3 4 5 6 7

First 4 4 4 4 4 4 4

35

10

30

15

25

40

20 17

8

15

11

211

2

3

4

5

6

75 73

1

20

21

Prim’s Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

1121

4

5

6

7

1

2

3

The minimum cost arc from yellow nodes to green nodes can be found by placing arc values in a priority queue.

22

Prim’s Algorithm in Action

1

3

354

5

30

15

25

40

20

6

7

17

8

15

1121

4

5

6

7

1

3522

10

25

102

3

23

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

5

6

73

4

24

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

15

5 73

64

25

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

1564

15

515

1173 5

26

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

1564

15

515

1173 5

27

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

1564

15

515

113 75

117

28

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

1564

15

515

117

1173 5153

29

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

1564

15

515

117

1173 5153

30

20

Prim’s Algorithm in Action

1

3

354

515

25

40

6

7

17

15

11

1

3522

10

25

102 4

10 8

2130

8

20 3021

68

17

1564

15

515

117

1173 5153

31

Sollin’s Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

11

21

Treat all nodes as singleton components, and then select the min cost arc leaving the component.

4

5

6

7

1

2

3

4

5

6

7

1

2

3

32

Sollin’s Algorithm in Action

1

2

3

35

104

5

30

15

25

40

20

6

7

17

8

15

11

21

Find the min cost edge out of each component

4

5

6

7

1

2

3 73 5

6