Download presentation
Presentation is loading. Please wait.
1
Communication Networks A Second Course Jean Walrand Department of EECS University of California at Berkeley
2
Graph Theory Routing Coloring QoS in Ad Hoc Neworks Percolations Note: Some slides from Abhay Parekh, others from Rajarshi Gupta
3
Routing Shortest Path: Principle of Optimality Algorithms Trees
4
Shortest Path Principle of Optimality: 5 10 4 54 1 3 2 ABD C If ABCD is the shortest path from A to D, then BCD is the shortest path from C to D V(A) = min X {L(A, X) + V(X)} : Dynamic Programming Equation If X achieves minimum, shortest path goes through X V(A) = min X {L(A, X) + V(X)} : Dynamic Programming Equation If X achieves minimum, shortest path goes through X V(C)= 3 V(D)= 0 V(B)= 4 V(E) = 6 V(F)= 4 V(A) = 9F E
5
Related Idea: Optimal Control Problem: Solution:
6
Related Idea: Optimal Control Variation: Solution:
7
Algorithms A A B B C C D D 2 1 1 3 A: [B, 2], [C, 1] B: [A, 2], [D, 1] C: [A, 1], [D, 3] D: [B, 1], [C, 3] 1) Exchange Link States2) Each node computes the shortest paths to the others LINK STATE A A B B C C D D 2 1 1 3 DISTANCE VECTOR 0 0 A A B B C C D D 2 1 1 3 1 0 3 A A B B C C D D 2 1 1 3 A A B B C C D D 2 1 1 3 PATH VECTOR D D A A B B C C D D 2 1 1 3 B,D C,D A A B B C C D D 2 1 1 3 “Don’t like B”
8
Dijkstra Goal at node 1: Find the shortest paths from 1 to all the other nodes. Strategy at node 1: Find the shortest paths in order of increasing path length 1 3 4 6 2 5 1 4 1 1 4 2 3 1 Dijkstra, E.W., “A Note on Two Problems in Connexion with Graphs,” Numerische Mathematik, vol. 1, pp. 269-271, 1959.
9
Dijkstra (continued) 1 3 6 2 5 1 4 1 1 4 2 3 1 0 4 1 3 4 6 2 5 1 4 1 1 4 2 3 1 0 1 4 1 3 4 6 2 5 1 4 1 1 4 2 3 1 0 1 4 4 2 1 3 4 6 2 5 1 4 1 1 4 2 3 1 0 1 3 3 2 6
10
1 3 4 6 2 5 1 4 1 1 4 2 3 1 0 1 3 3 2 6 1 3 4 6 2 5 1 4 1 1 4 2 3 1 0 1 3 3 2 5
11
Dijkstra: Correctness Thm: Label v(i) is the shortest path cost to i Lemma: At one stage, algorithms labels nodes in a set P. It then adds nodes to P. Labels in P are the shortest path involving nodes in P. Then when P = V, the theorem holds Proof of Lemma Suppose we have a shorter path using node in T Let p, q in P be two nodes in path, with t in T in between But if v(p) + d(p, t) + d(t, q) < v(p) + d(p, q), then we would have picked t before q (Contradiction)
12
Bellman-Ford Update: when receive estimates D(i,d) = min jεN(i) {c(i,j) + D(j,d)} 1 3 4 6 2 5 1 4 1 1 4 1 2 3 1 iDiDi 1(0,1,∞,∞,∞,4) 2(1,0,3,∞, 1,∞) 3(∞,3,0,2, 1,∞) 4(∞,∞,2,0, 4,∞) 5(∞,1,1,4, 0,1) 6(4,∞,∞,∞,1,0) 3 gets updates from 2 and 5 D(3,1) = min{c(3,2) + D(2,1), c(3,5) + D(5,1)} = min{ 3 + 1, 1 + ∞ } = 4
13
Bellman-Ford Focus on destination 1 Here are the values of D(i,1): 1 3 4 6 2 5 1 4 1 1 4 1 2 3 1 i1234567 10000000 2∞111111 3∞∞43333 4∞∞∞6555 5∞∞22222 6∞443333 step
14
Counting to Infinity ABC 0 12 ABC 0 34 ABC 0 56 Ping-Pong to Eternity All links cost 1
15
Bad News Travels Slowly… 43 2 1 1 1 1 M 1 D(2,1)=2, D(3,1)=1, D(4,1)=2
16
Bad News Travels Slowly… 43 2 1 1 1 1 M 1 Node 2 takes about M Iterations to figure out that D(2,1)=M Fundamental Cause: After a network change, think of the network protocol running from time 0. The initial conditions are arbitrary… Tricks exist to get around these problems but not fool proof
17
Asynchronous Bellman Ford In general, nodes are using different and possibly inconsistent estimates If no link changes after some time t, the algorithm will eventually converge to the shortest path No synchronization required at all…
18
Oscillations Link costs must reflect link speed AND congestion Under both LSP and DV routing occurs over a tree The costs of the links of this tree will increase The other links will not be congested Their costs will drop Routing protocol will shift traffic and create a new tree This process of shifting and reshifting can be severe Way out: Change congestion costs slowly (exponential averaging) – Route dampening
19
Oscillations - Example 1 2 3 4 5 5 1 1 Traffic Heavy Load High Delay Light Load Low Delay 1 2 3 4 1 5 5 1 Traffic Light Load Low Delay Heavy Load High Delay
20
Link State vs. Distance Vector No clear winner LS is robust since it each node computes its own routes independently Suffers from the weaknesses of the topology update protocol. Inconsistency etc. Excellent choice for a well engineered network within one administrative domain E. g. OSPF DV works well when the network is large since it requires no synchronization and has a trivial topology update algorithm Suffers from convergence delays Very simple to implement at each node Excellent choice for large networks E.g. RIP
21
Trees Root
22
Useful Trees Types of Trees Binary Tree Each non-leaf node has exactly 2 children Ternary Tree Height Balanced Tree Root chosen s.t. height is minimized Bipartite Graphs Induced Trees Formed by choosing a subset of V,E from G Rooted Tree Rooted at particular node Spanning Tree Covers every node ‘Subset Spanning Tree’ Covers every node in a chosen subset
23
Trees in Networks Broadcast Tree Search Trees BFS DFS Spanning Tree Protocol (STP) in Bridged Networks (e.g. Ethernet) Multicast Tree And many, many other places …
24
Trees and Ethernet Tree Feature Connected No cycles Removing any edge makes it disconnected Adding any edge forms a cycle Every pair of nodes has unique path Ethernet Behavior Need all LANs to talk Loops cause broadcast storms Any bridge/port failure needs recomputation Need to disable all redundant ports Guarantees path with STP
25
Concrete Example Weight balanced Spanning Tree (WBST) Each edge has cost e.g. 10/100/1000 Mbps Choose spanning tree that has min difference between min and max edge cost Want to minimize buffering requirements as packets move through the network. Also control jitter. Complexity
26
Recall Spanning Tree Algos Kruskal’s Greedy Algorithm to compute Spanning Tree 1. Order the edges in term of weight 2. Add lowest cost edge (provided no loops) 3. Check if all vertices are connected 4. If not, return to step 2 Any search (BFS/DFS) can check for connectedness BFS/DFS may be performed in O(m)
27
WBST : Algorithm Sort edges in increasing order of weight c 1 <c 2 <…<c m Initialize: diff = c m -c 1, low = 1, high = 1 Take G low,high = G (V, {c i : low i high}) if G low,high is connected if diff > (c high – c low ) diff := c high – c low Remember low, high low := low + 1 repeat else high := high + 1 repeat
28
WBST : Correctness Spanning Tree exists By checking G low,high is connected => spanning tree must exist Do this using DFS. Also finds the WBST Why balanced Keep adding low cost edges till graph connected Then try to discard as many low cost edges Move both ‘low’ and ‘high’ pointers to consider other ranges Remember best diff
29
WBST : Complexity In each iteration, we either increment low, or increment high So max number of iterations = 2m Each iteration needs to check connectedness: DFS O(m) So entire algo is O(m 2 ) Think: How would we make this algorithm distributed
30
Multicast Trees Application: Want to send packets from a source (e.g. internet radio station) to many hosts Sending n copies of the stream is wasteful Solution: Form tree rooted at source that spans all member nodes
31
Distributed Algorithm Need to know address of group First Join First member sends route request Request will be forwarded all the way to source Confirmation flows back to member All routers in path will add entry (mc_addr | port) Subsequent Join New member send route request Request forwarded to router that has mc_addr entry Send confirmation from this point on Augment route entry (mc_addr | port1, port2) Think: Optimal multicast tree
32
Multicast Algorithm (contd) Leave/Pruning Node leaving sends leave message to router Router removes port from route entry If last port entry deleted, send prune message to parent Multi-source multicast tree Less optimal: packets between two branches travel long distance But need to minimize state in routers
33
Coloring: History Map coloring: Color all countries on a map using fewest colors Model: Each country is a node, edge if share boundary This forms a planar graph (edges don’t intersect)
34
4 & 5 Color Theorems Five color theorem: Every planar graph is 5- colorable Heawood, 1890 Four Color Theorem: Every planar graph is 4- colorable Conjectured for many years (since 1890) Proved by Appel and Haken (1977) Can do no better than 4 colors K 4 (complete graph in 4 vertices) is planar
35
Independent Sets (IS) Set of nodes that do not have an edge between them Set of nodes that can have the same color Maximal IS: not contained in any other IS Result: Number of maximal IS in a graph is exponential Graph coloring algorithms find IS Finding the chromatic number of a graph is NP-hard Many approximations exist
36
Approximate Coloring Greedy Algorithm Order nodes by degree Add first node to IS Discard all neighbors into a Future bin Repeat till set empty Start with future bin Correctness Are the sets generated independent ? Are they maximal ? Complexity Each iteration adds one node, so O(m) Discarding neighbors O(n) Total: O(mn) Follow up: How far is this from optimal coloring Arbitrary or Bounded Many approx algos give coloring within 4X, 6X of optimal
37
Cliques Observe Each node in a clique needs a different color So Clique is complement of IS Maximal Cliques: ABC, BCEF, CDF Definitions Clique = Complete Subgraph Maximal Clique = Clique not a subset of any other Clique Number = size of largest clique = 4
38
Perfect Graphs A graph is said to be perfect when its Chromatic Number Clique Number Are equal For all induced subgraphs Strong Perfect Graph Theorem Chudnovsky, Robertson, Seymour, Thomas (2002) A graph is perfect if and only if it has no odd holes or odd anti-holes Odd-hole is a odd cycle with no chord Odd anti-hole is complement of odd-hole
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.