Lecture 8 - Shortest-Path Trees (SPT) - PowerPoint PPT Presentation

Loading...

PPT – Lecture 8 - Shortest-Path Trees (SPT) PowerPoint presentation | free to download - id: 21b06d-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Lecture 8 - Shortest-Path Trees (SPT)

Description:

Dijkstra's Algorithm. 1. Mark every node as unscanned and give each node a ... If we run Dijkstra's algorithm on a sparse graph, we will get a tree with a fair ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 18
Provided by: dream1
Learn more at: http://lyle.smu.edu
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Lecture 8 - Shortest-Path Trees (SPT)


1
Lecture 8 - Shortest-Path Trees (SPT)
  • Definition 3.19
  • Given a weighted graph (G,W) and nodes n1 and
    n2, the shortest path from n1 to n2 is a path P
    such that
    is a minimum.
  • Definition 3.20
  • Given a weighted graph (G,W) and a node n1, a
    shortestpath tree rooted at n1 is a tree T such
    that, for any other node n2 G, the path from
    n1 to n2 in the tree T is a shortest path between
    the nodes.

2
Dijkstras Algorithm
  • 1. Mark every node as unscanned and give each
    node a label of
  • 2. Set the predecessor of the root to itself. The
    root will be the only node that is its own
    predecessor.

3
  • 3. Loop until you have scanned all the nodes.
  • -Find the node n with the smallest label. Since
    the label represents the distance to the root we
    call it d_min.
  • -Mark the node as scanned.
  • -Scan all the adjacent nodes m and see if the
    distance to the root through n is better than the
    distance stored in the label of m. If it is,
    update the label and update predmn.
  • 4. When the loop finishes, we have a tree stored
    in pred format rooted at root.

4
1
2
Example
5
6
4
3
7
4
9
8
MST
SPT Rooted at 4
1
2
1
2
6
4
3
6
8
9
Total Cost 16
Total Cost 26
5
SPT vs. MST
  • Lower utilization of the links
  • More cost
  • Important
  • Smaller average number of hops

Actually we will compare star (a kind of SPT)
with MST, because
6
Star vs. MST
  • If we run Dijkstras algorithm on a sparse graph,
    we will get a tree with a fair number of nodes
    not connected directly to the root.
  • If we run Dijkstras algorithm on a complete
    graph (exactly what were studying now), then we
    usually get a star.

7
Star vs. MST (contd)
  • Design Name Ave Hops MAX_UTIL Cost
  • MST 13.9479 0.493
    325.516
  • Star 1.9800 0.09
    453.861

Prims algorithm produces much shorter paths but
can produce very expensive networks. SPT is not
good, either. Is there some middle ground between
MST and SPT?
8
PrimDijkstra Trees
  • Algorithm Label
  • Prims
  • 2) Dijkstras
  • 3) Prim-Dijkstras
  • build a tree by starting at a node and bringing
    in nodes by selecting the one with smallest label
  • Use the label
  • (a)dist(root,neighbor) (1-a)dist(neighbor,node)
  • for 0 lt a lt 1

9
PrimDijkstra Trees
  • a 1 gt Prim (cheep)
  • a 1 gt Dijkstra (short hops)
  • 0 lt a lt 1 gt Mixture

2
1
Example with a 0.7 higher priority to small
hop count
5
7
3
4
6
8
9
10
Step 1 begin at node 4
(.7)(6)(.3)(6)6
(.7)(7)(.3)(7)7
(.7)(8)(.3)(8)8
(.7)(9)(.3)(9)9
The winner is 6
11
Step 2
(.7)(8)(.3)(2)6.2
(.7)(7)(.3)(1)5.2
(.7)(11)(.3)(5)8.2
7
8
9
The winner is 5.2
12
Step 3
6.2
8.2
(.7)(11)(.3)(4)8.9
7
8
9
The winner is 6.2
13
Step 4
8.2
(.7)(11)(.3)(3)8.6
8.9
8
9
The winner is 8
14
Step 5
8.6
9
The winner is 8.6
15
Summary
SPT - Cost 26
MST - Cost 16
Prim-Dijkstra Cost 20
16
Prim Dijkstra Trees (contd)
a Ave Hops Link delay Cost 0 13.9479 0.3066 325,
516 0.1 10.5717 0.1451 280,162 0.2 7.8640 0.1067
247,217 0.3 6.7762 0.0913 243,551 0.7 3.0186 0.
0380 295,012 0.8 2.2879 0.0277 378,792 0.9 1.980
0 0.0233 453,861
17

Proceed to HW 5
About PowerShow.com