Upload
sun
View
46
Download
0
Embed Size (px)
DESCRIPTION
MINIMUM SPANNING TREE. A NEW APPROACH. Types of network. THE INTERPRETATION. BACKUP PATHS. b. c. a. d. f. e. THE PROBLEM. Occurring of loops. EXISTING SOLUTIONS. Prim’s algorithm. Kruskal algorithm. Both of them take time O(n lg n) . - PowerPoint PPT Presentation
Citation preview
A NEW
APPROACH
MINIMUMSPANNING
TREE
TYPES OF NETWORK
LAN WAN Internet
THE INTERPRETATION
a
b
e
c
d
f
BACKUP PATHS
OCCURRING OF LOOPS
THE PROBLEM
EXISTING SOLUTIONS
PRIM’S ALGORITHM
KRUSKAL ALGORITHM
Both of them take timeO(n lg n)
A SPANNING TREE All the routers are included
Cycles are eliminated
Each router has knowledge of some Spanning Tree
THE TASK
Generating a Spanning Treehaving least cost
Different MST algorithmsare used
THE CHALLENGE
DESIGNING A MST ALGORITHM HAVINGLEAST COMPLEXITY
PREREQUISITES
The algorithm must not exceed the order O(n lg n) , desirable. It must be practically implementable
KEY IDEA
GREEDY APPROACH
At every stage make a locally optimal choice Leads to globally optimal solution
IMPLEMENTATION Each router maintains 2 data structures
A Disjoint Set for maintaining set of connected routers
A Priority Queue for all the routers connected to it
ON A GRAPH Each vertex maintains a Min- Priority Queue, based on a key field
A Disjoint-Set data structure is maintained
1. S<- NULL2. FOR EACH VERTEX, v V[G]3. MAINTAIN A MINIMUM PRIORITY
QUEUE VG
4. MAKE SET(v)
THE ALGORITHM - MBA
THE STEPS
5. FOR EACH VERTEX V V[G]6. U <- EXTRACT-MIN (QV)7. IF(u,v) S8. S<- S U {(u,v)}9. FOR EACH EDGE (u,v) E(S)10. IF FIND-SET(u) ≠ FIND-SET(v)11. UNION(u,v)
12. FOR EACH EDGE, (u,v) E(G)13. IF FIND-SET(u)= FIND-SET(v)14. w(u,v)=∞15.FOR EACH VERTEX, v V[G]16. u<- EXTRACT-MIN( QV)17. IF (u,v) S18. S<- S U {(u,v)}
19. IF FIND-SET (u)≠ FIND-SET (v)20. UNION (u,v)21. ELSE22. S<- MAX{(x,y)}, (xy)
SET(u)23. RETURN S
WORKING
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
28
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14
29
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14∞
∞
∞
∞ ∞
∞
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14∞ ∞
∞
∞∞
∞
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14∞
∞
∞
∞∞
∞
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14∞ ∞
∞
a
b
h
c d
e
fg
i
49 7
9
10
218
117 6
2
4 14∞
∞
∞
∞∞
∞
a
b
h
c d
e
fg
i
49 7
9
1021
8
117 6
2
4 14∞
∞
∞∞
∞∞
a
b
h
c d
e
fg
i
49 7
9
1021
8
117 6
2
4 14∞
∞
∞∞
∞∞
a
b
h
c d
e
fg
i
49 7
9
1021
8
117 6
2
4 14∞
∞
∞∞
∞∞
a
b
h
c d
e
fg
i
49 7
9
1021
8
117 6
2
4 14∞
∞
∞
∞
∞
∞
a
b
h
c d
e
fg
i
49 7
9
1021
8
117 6
2
4 14∞
∞
∞
∞∞
∞
ANALYSIS Running time depends upon
Implementation of Disjoint Set Data Structure
Implementation of Priority
Queue
Disjoint-Set uses :
Union by Rank Path Compression
Priority Queue : Min-Priority Queue
ANALYSIS
ANALYSIS Time taken at each step :
Line 1 : O(1) Lines 2 & 5 : O(V)
Make Set operation : O(V)
Build Heap : O(log2V) For ‘V’ vertices : O(V log2V)
Extract – min : O(log2V) For all vertices : O(V log2V)
for loops in lines 9-11 & 12-14 : O(E)
ORDER TILL LINE 14 :
O ( V LOG2V )
Same process is repeatedonce more
Overall complexity : O ( V log2V )
NEWER DIMENSIONS
WHEN USED WITH PARALLEL PROCESSORSO(E) CAN BE ACHIEVED
BACKUP PATHS CAN BE FOUND FASTER
CYCLES CAN BE ELIMINATED
MORE EFFICIENTLY