Sample Solutions to Homework #4

Size: px
Start display at page:

Download "Sample Solutions to Homework #4"

Transcription

1 National Taiwan University Handout #25 Department of Electrical Engineering January 02, 207 Algorithms, Fall 206 TA: Zhi-Wen Lin and Yen-Chun Liu Sample Solutions to Homework #4. (0) (a) Both of the answers returned by the FIND-SET operations are x. The resulting data structure is shown in Figure. (b) Both of the answers returned by the FIND-SET operations are x 6. The resulting data structures are shown in Figure 2. Figure : The result of the FIND-SET operations. 2. (0) Figure 2: (a) The result of FIND-SET(x 2 ); (b) The result of FIND-SET(x 9 ). Given a directed acyclic graph G = (V, E), we wish to find another way to perform topological sorting by repeatedly finding a vertex of in-degree 0, outputting it, and removing this vertex and all of its outgoing edges from the graph.

2 NEW TOPOLOGICAL SORTING(G) for each vertex v V [G] 2 do in degree[v] 0 3 for each vertex u V [G] 4 for each vertex v Adj[u] 5 do in degree[v] in degree[v] + 6 Q φ 7 for each vertex v V [G] 8 do if in degree[v] = 0 9 then ENQUEUE(Q, v) 0 while Q φ do v DEQUEUE(Q) 2 print v 3 for each vertex k Adj[v] 4 do in degree[k] in degree[k] 5 if in degree[k] = 0 6 then ENQUEUE(Q, k) 7 for each vertex v V [G] 8 if in degree[v] 0 9 then print There is a cycle! Computing all vertices in-degrees takes Θ(V + E) because V is the number of adjacency lists that are accessed and totally E edges are found in these lists. As we process each vertex from the queue, we effectively remove its outgoing edges from the graph by decrementing the in-degree of each vertex one of those edges enters, and we enqueue any vertex whose in-degree goes to 0. Each vertex is enqueued/dequeued at most once because it is enqueued only if it starts out with in-degree 0 or if its in-degree becomes 0 after being decremented some number of times. The processing of a vertex from the queue happens O(V ) times because no vertex can be enqueued more than once. The adjacency list of each vertex is scanned at most once because each vertex is dequeued at most once. Since the sum of the lengths of all the adjacency lists is Θ(E), at most O(E) time is spent in total scanning adjacency lists. For each edge in an adjacency list, Θ() work is done, for a total of O(E) time. Thus the total time taken by the algorithm is O(V + E). If there are cycles it will detect, because some in-degrees will never become (0) (a) G has an Euler tour in-degree(v) = out-degree(v) for each vertex v: Given a graph G with a Euler tour, we can find a tour that goes through all edges in G without repetition with the same source and target. It is clear that, for each vertex v in the cycle, the numbers of edges that go in and go out v must be equal. in-degree(v) = out-degree(v) for each vertex v G has an Euler tour: Since the in-degree and out-degree of eachvertex v V are equal, we can find a cycle from an arbitrary vertex. Then, the edges in the cycle are removed. We also can find a cycle from a remaining vertex that still has edges connecting to it. The process repeats until noedge is available. By traversing edges in the depth first order once a cycles is met, we can find a Euler tour (see Figure 3 for an illustration). (b) The algorithm to find an Euler tour on G is described in the above. Since we continue remove edges from G until no edge is available, the time complex is O(E). 4. (0) Construct an undirected graph G, where each vertex represents the corresponding unshaded square. The edges are constructed between each pair of neighboring unshaded squares. Then, the shortest tour can be found by applying BFS algorithm on G. Since the number of neighbors of each square is at most 4, it implies that E = O(4V ) in G, where V and E denotes the numbers of vertices and edges separately. So the time complexity is O(V + E) = O(V ). 2

3 Figure 3: An Euler tour. 4/5 0/ 6/7 3/4 7/8 2/3 5/2 6/ 9/0 Figure 4: (a) The resulting graph G after applying DFS (a value associated with each node denotes the finishing time). (b) Compute G T, and then apply DFG on G T. (c) The resulting graph composed of four strongly connected components denoted by different colors. 5. (0) 6. (0) (a) Construct an undirected graph G(V, E), where V = {A, B, C, D}, and every edge e = (v, v 2 ) E if and only if there is a bridge connecting v and v 2. Associate every edge with a direction to make G a directed graph G such that there exists a Euler tour in G. (b) No. By Problem 3, the degree of every vertex in G should be even in order to derive a Euler tour. However, the degree of every vertex in G is odd. The process to find strongly connected components are shown in Figure 4: 7. (0) Exercise (page 637) Let T = (V, E T ) be the given minimum spanning tree of G = (V, E). Let T = (V {v}, E T ) be a minimum spanning tree of G = (V {v}, E E v ), where v is the new added vertex to G and E v = {(u, v) : u V } is the set of corresponding incident edges. We show that we can update T into T in O(V lg V ) time as follows. First, we claim that E T (E T E v ); that is, T contains only the edges in E T E v. To prove this claim, consider a spanning tree T s of G, where T s contains an edge set E s G E T. For any edge e s = (x, y) E s, we can always find an edge e t E T E v, where e t incidents on x or y and e t s weight is less than or equal to e s s weight because T is a minimum spanning tree of G. That is, we can always replace all edges in E s by the corresponding edges in E T E v and obtain a spanning tree whose cost is less than or equal to the cost of T s. Thus, for any minimum spanning tree containing edges in G E T, we can always find another minimum spanning tree containing only the edges in E T E v. Second, because E T E T E v holds true, T is the subgraph of G r = (V {v}, E r ) = (V {v}, E T E v ). Because E T = V and E v V, we immediately know that E r = E T E v E T + E v < 2 V = O(V ). Thus, we can find T in G r using a minimum-spanning-tree algorithm (such as Kruskal s algorithm) in O(E r lg V ) = O(V lg V ) time. 3

4 8. (5) Problem 23-3 (page 640) (a) Assume a minimum spanning tree T which is not a bottleneck spanning tree T b. The maximum weight w of edge e in T must be larger than the maximum weight w b of edge e b in T b. In other words, w is larger than any edge weights in T b. Thus, we could replace edge e by an edge in T b and T remains a spanning tree. Then the total edge weight of T would be smaller than original T. Thus, T is impossible to be a minimum spanning tree. In conclusion, a minimum spanning tree T must be a bottleneck spanning tree. (b) To determines whether the value of the bottleneck spanning tree is at most b. We can apply DFS once on a random vertex of G ignoring edge weight is bigger than b to see if every edge of G is visited. If is, then the value of the bottleneck spanning tree is at most b. CHECKBOTTLENECK(G, b) for each vertex u V [G] do 2 color[u] WHITE 3 u randomly chosen vertex in G 4 DFS(u, b) 5 for each vertex u V [G] do 6 if color[u] = WHITE then 7 return f alse 8 return true Figure 5: The Pseudo-code for the CHECKBOTTLENECK procedure. DFS(u, b) color[u] GRAY 2 for each v Adj[u] do 3 if color[v] = WHITE and w(u, v) b then 4 DFS(v, b) 5 color[u] BLACK Figure 6: The Pseudo-code for the DFS procedure. (c) We could use an algorithm like binary search to find the value of bottleneck spanning tree. Let b represent the value of the bottleneck spanning tree. We first find the median weight w m of every edge. Then remove all the edges with weights larger than w m and use the CHECKBOTTLENECK procedure to determine if w m < b. If it does, we recursively find w m in the remain edges and do the same procedure. Otherwise, we contract (in textbook Section B.4) all the edge visited in the DFS procedure of the CHECKBOTTLENECK procedure. Then, recursively find w m in the removed edges in this iteration and do the same procedure. The bottleneck spanning tree T and its value b can be found when there is only one edge in the contracted graph. Since we either contract all the visited edges or decrease half of the remaining edges, the time complexity of this algorithm can be ensured as linear time. 9. (0) Exercise (page 657) We ll give two ways to transform a PERT chart G = (V, E) with weights on vertices to a PERT chart G = (V, E ) with weights on edges. In each way, we ll have that V 2 V and E V + E. We can then run on G the same algorithm to find a longest path through a directed acyclic graph (in Section 24.2 of the textbook). In the first way, we transform each vertex v V into two vertices v and v in V. All edges in E that enter v will enter v in E, and all edges in E that leave v will leave v in E. In other words, 4

5 if (u, v) E, then (u, v ) E. All such edges have weight 0. We also put edges (v, v ) into E for all vertices v V, and these edges are given the weight of the corresponding vertex v in G. Thus, V = 2 V, E = V + E, and the edge weight of each path in G equals the vertex weight of the corresponding path in G. In the second way, we leave vertices in V alone, but we add one new source vertex s to V, so that V = V {s}. All edges of E are in E, and E also includes an edge (s, v) for every vertex v V that has in-degree 0 in G. Thus, the only vertex with in-degree 0 in G is the new source s. The weight of edge (u, v) E is the weight of vertex v in G. In other words, the weight of each entering edge in G is the weight of the vertex it enters in G. In effect, we have pushed back the weight of each vertex onto the edges that enter it. Here, V = V +, E V + E (since no more than V vertices have in-degree 0 in G), and again the edge weight of each path in G equals the vertex weight of the corresponding path in G. 0. (20) We first run topological sort on the graph G(V, E), which takes O( V + E ) time. Given two vertex s and t, we know that any path that runs between s and t must use only the vertices located between s and t in the topological sort. If there was a vertex a < s in the topological sort, then there cannot be a path from s a in G. Likewise there can be no vertex b > t on a path from s to t. Then, we can use dynamic programming to calculate the number of paths. For each vertex v i V, where i means that v i is the i-th vertex in the topological sort, we calculate paths[i], the number of paths ending at v i. Then we sum up these derived paths[i] s to get the total number of paths in G. Note that the sum-up action takes O( V ) time. Here shows the dynamic programming to derive paths[i] s. First, the recurrence for paths[i] s are shown as follows: { + (v paths[i] = paths[j], in-degree(v j,v i) E i) > 0, (), otherwise. Using Equation, we calculate paths[i] from i = to V. The calculations take also O( V + E ) time. Note that we need O( V ) space to store paths[i] s. Then the total number of paths in G is V i= paths[i], which takes O( V ) time. From the above analysis, our algorithm takes O( V + E ) time and uses O( V ) space to store additional items.. (0) After applying Bellman-Ford algorithm, we could find the value of x 5 that still could be modified. The negative cycle is: x 5 x x 4 x 2 x 3 x 5 (See Figure 7). Thus, there is no feasible solution exists. 2. (0) Problem 24-3 (page 679) (a) We can use the Bellman-Ford algorithm on a suitable weighted, directed graph G = (V, E), which we form as follows. There is one vertex in V for each currency, and for each pair of currencies c i and c j, there are directed edges (v i, v j ) and (v j, v i ). (Thus, V = n and E = ( n 2 ).) To determine edge weights, we start by observing that if and only if R[i, i 2 ] R[i 2, i 3 ] R[i k, i k ] R[i k, i ] > R[i, i 2 ] R[i 2, i 3 ] R[i k, i k ] R[i k, i ] <. Taking logs of both sides of the inequality above, we express this condition as lg R[i, i 2 ] + lg R[i 2, i 3 ] + + lg R[i k, i k ] + lg R[i k, i ] < 0. 5

6 Figure 7: The negative cycle of exercise Therefore, if we define the weight of edge (v i, v j ) as w(v i, v j ) = lg = lg R[i, j], R[i, j] then we want to find whether there exists a negative-weight cycle in G with these edge weights. We can determine whether there exists a negative-weight cycle in G by adding an extra vertex v 0 with 0-weight edges (v 0, v i ) for all v i V, running BELLMAN-FORD from v 0, and using the boolean result of BELLMAN-FORD (which is TRUE if there are no negative-weight cycles and FALSE if there is a negative-weight cycle) to guide our answer. That is, we invert the boolean result of BELLMAN-FORD. This method works because adding the new vertex v 0 with 0-weight edges from v 0 to all other vertices cannot introduce any new cycles, yet it ensures that all negative-weight cycles are reachable from v 0. It takes Θ(n 2 ) time to create G, which has Θ(n 2 ) edges. Then it takes O(n 3 ) time to run BELLMAN-FORD. Thus, the total time is O(n 3 ). Another way to determine whether a negative-weight cycle exists is to create G and, without adding v 0 and its incident edges, run either of the all-pairs shortest paths algorithms. If the resulting shortest-path distance matrix has any negative values on the diagonal, then there is a negative-weight cycle. (b) Assuming that we ran BELLMAN-FORD to solve part (a), we only need to find the vertices of a negative-weight cycle. We can do so as follows. First, relax all the edges once more. Since there is a negative-weight cycle, the d value of some vertex u will change. We just need to repeatedly follow the π values until we get back to u. In other words, we can use the recursive method given by the PRINT-PATH procedure of Section 22.2, but stop it when it returns to vertex u. 6

7 The running time is O(n 3 ) to run BELLMAN-FORD, plus O(n) to print the vertices of the cycle, for a total of O(n 3 ) time. 3. (5) Exercise (699) The matrices D (k) are D (0) = D (3) = (0) Exercise (705), D() =, D(4) = , D(2) = It changes shortest paths. Consider the following graph. V = {s, x, y, z}, and there are 4 edges: w(s, x) = 2, w(x, y) = 2, w(s, y) = 5, and w(s, z) = 0. So we would add 0 to every weight to make ŵ. With w, the shortest path from s to y is s x y, with weight 4. With ŵ, the shortest path from s to y is s y, with weight 5. (The path s x y has weight 24.) The problem is that by just adding the same amount to every edge, you penalize paths with more edges, even if their weights are low. 5. (0) (a) In Dijkstra s algorithm, use the reliability as the edge weight and substitute. max (and EXTRACT-MAX) for min (and EXTRACT-MIN) in relaxation and the queue. for + in relaxation. (identity for ) for 0 (identity for +) and (identity for min) for (identity for max). For example, the algorithm in Figure 8 is used instead of the usual RELAX procedure. This algorithm is isomorphic to the one above: It performs the same operations except that it is working with the original probabilities instead of the transformed ones. The time complexity is O(V lgv +E)., RELAX-RELIABILITY(u, v, r) if d[v] < d[u] r(u, v) 2 then d[v] d[u] r(u, v) 3 π[v] u Figure 8: The Pseudo-code for the RELAX procedure. (b) To find the maximum reliability path between each pair of vertices, we modify each entry of W matrix as follows: if i = j, w ij = µ ij if i j and (i, j) E, 0 if i j and (i, j) E. 6. (40) DIY. we can use the algorithm in Figure 9. d (k) ij is the maximum reliability on path i j using vertices with index k. Further, we modify the predecessor matrix Π for k as follows: π (k) ij = { π (k ) ij π (k ) kj if d (k ) ij if d (k ) ij d (k ) ik < d (k ) ik d (k ) kj, d (k ) kj. 7

8 Max-Reliability(W ) n rows[w ] 2 D (0) W 3 for k to n 4 for i to n 5 for j to n 6 d (k) ij 8 return D (n) max(d (k ) ij, d (k ) ik d (k ) kj ) Figure 9: Determine the maximum capacity path between each pair of vertices. 8

Elementary Graph Algorithms

Elementary Graph Algorithms Elementary Graph Algorithms Graphs Graph G = (V, E)» V = set of vertices» E = set of edges (V V) Types of graphs» Undirected: edge (u, v) = (v, u); for all v, (v, v) E (No self loops.)» Directed: (u, v)

More information

Representations of Graphs

Representations of Graphs ELEMENTARY GRAPH ALGORITHMS -- CS-5321 Presentation -- I am Nishit Kapadia Representations of Graphs There are two standard ways: A collection of adjacency lists - they provide a compact way to represent

More information

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V)

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V) Graph Algorithms Graphs Graph G = (V, E) V = set of vertices E = set of edges (V V) Types of graphs Undirected: edge (u, v) = (v, u); for all v, (v, v) E (No self loops.) Directed: (u, v) is edge from

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 18 Graph Algorithm Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Graphs Graph G = (V,

More information

Graph implementations :

Graph implementations : Graphs Graph implementations : The two standard ways of representing a graph G = (V, E) are adjacency-matrices and collections of adjacencylists. The adjacency-lists are ideal for sparse trees those where

More information

Outlines: Graphs Part-2

Outlines: Graphs Part-2 Elementary Graph Algorithms PART-2 1 Outlines: Graphs Part-2 Graph Search Methods Breadth-First Search (BFS): BFS Algorithm BFS Example BFS Time Complexity Output of BFS: Shortest Path Breath-First Tree

More information

Unit 5F: Layout Compaction

Unit 5F: Layout Compaction Course contents Unit 5F: Layout Compaction Design rules Symbolic layout Constraint-graph compaction Readings: Chapter 6 Unit 5F 1 Design rules: restrictions on the mask patterns to increase the probability

More information

Unit 3: Layout Compaction

Unit 3: Layout Compaction Unit 3: Layout Compaction Course contents Design rules Symbolic layout Constraint-graph compaction Readings: Chapter 6 Unit 3 1 Design rules: restrictions on the mask patterns to increase the probability

More information

Unit 2: Algorithmic Graph Theory

Unit 2: Algorithmic Graph Theory Unit 2: Algorithmic Graph Theory Course contents: Introduction to graph theory Basic graph algorithms Reading Chapter 3 Reference: Cormen, Leiserson, and Rivest, Introduction to Algorithms, 2 nd Ed., McGraw

More information

Graph Representation

Graph Representation Graph Representation Adjacency list representation of G = (V, E) An array of V lists, one for each vertex in V Each list Adj[u] contains all the vertices v such that there is an edge between u and v Adj[u]

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no

More information

Chapter 22. Elementary Graph Algorithms

Chapter 22. Elementary Graph Algorithms Graph Algorithms - Spring 2011 Set 7. Lecturer: Huilan Chang Reference: (1) Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. (2) Lecture notes from C. Y. Chen

More information

Graph Algorithms: Chapters Part 1: Introductory graph concepts

Graph Algorithms: Chapters Part 1: Introductory graph concepts UMass Lowell Computer Science 91.503 Algorithms Dr. Haim Levkowitz Fall, 2007 Graph Algorithms: Chapters 22-25 Part 1: Introductory graph concepts 1 91.404 Graph Review Elementary Graph Algorithms Minimum

More information

Basic Graph Algorithms (CLRS B.4-B.5, )

Basic Graph Algorithms (CLRS B.4-B.5, ) Basic Graph Algorithms (CLRS B.-B.,.-.) Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices V and a finite set of edges E. Directed graphs: E is a set of ordered pairs of vertices

More information

from notes written mostly by Dr. Carla Savage: All Rights Reserved

from notes written mostly by Dr. Carla Savage: All Rights Reserved CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among

More information

Introduction to Algorithms. Lecture 11

Introduction to Algorithms. Lecture 11 Introduction to Algorithms Lecture 11 Last Time Optimization Problems Greedy Algorithms Graph Representation & Algorithms Minimum Spanning Tree Prim s Algorithm Kruskal s Algorithm 2 Today s Topics Shortest

More information

Fundamental Algorithms CSCI-GA /Summer Solution to Homework 8

Fundamental Algorithms CSCI-GA /Summer Solution to Homework 8 Fundamental Algorithms CSCI-GA.70-00/Summer 206 Solution to Homework 8 Problem (CLRS 23.-6). ( point) Show that a graph has a unique minimum spanning tree if, for every cut of the graph, there is a unique

More information

COT 6405 Introduction to Theory of Algorithms

COT 6405 Introduction to Theory of Algorithms COT 6405 Introduction to Theory of Algorithms Topic 14. Graph Algorithms 11/7/2016 1 Elementary Graph Algorithms How to represent a graph? Adjacency lists Adjacency matrix How to search a graph? Breadth-first

More information

Graph representation

Graph representation Graph Algorithms 1 Graph representation Given graph G = (V, E). May be either directed or undirected. Two common ways to represent for algorithms: 1. Adjacency lists. 2. Adjacency matrix. When expressing

More information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo

More information

Graphs. Graphs. Representation of Graphs. CSE 680 Prof. Roger Crawfis. Two standard ways. Graph G = (V, E)» V = set of vertices

Graphs. Graphs. Representation of Graphs. CSE 680 Prof. Roger Crawfis. Two standard ways. Graph G = (V, E)» V = set of vertices Introduction to Algorithms Graph Algorithms CSE 680 Prof. Roger Crawfis Partially from io.uwinnipeg.ca/~ychen2 Graphs Graph G = (V, E)» V = set of vertices» E = set of edges (V V) V) Types of graphs» Undirected:

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms s of s Computer Science & Engineering 423/823 Design and Analysis of Lecture 03 (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 29 s of s s are abstract data types that are applicable

More information

Minimum Spanning Trees My T. UF

Minimum Spanning Trees My T. UF Introduction to Algorithms Minimum Spanning Trees @ UF Problem Find a low cost network connecting a set of locations Any pair of locations are connected There is no cycle Some applications: Communication

More information

Graph Search. Adnan Aziz

Graph Search. Adnan Aziz Graph Search Adnan Aziz Based on CLRS, Ch 22. Recall encountered graphs several weeks ago (CLRS B.4) restricted our attention to definitions, terminology, properties Now we ll see how to perform basic

More information

TIE Graph algorithms

TIE Graph algorithms TIE-20106 1 1 Graph algorithms This chapter discusses the data structure that is a collection of points (called nodes or vertices) and connections between them (called edges or arcs) a graph. The common

More information

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph:

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Graph G(V, E): V set of nodes (vertices); E set of edges. Notation: n = V and m = E. (Vertices are numbered

More information

Minimum Spanning Trees Ch 23 Traversing graphs

Minimum Spanning Trees Ch 23 Traversing graphs Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs

More information

Graph: representation and traversal

Graph: representation and traversal Graph: representation and traversal CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang! Acknowledgement The set of slides have use materials from the following resources Slides for textbook

More information

CSI 604 Elementary Graph Algorithms

CSI 604 Elementary Graph Algorithms CSI 604 Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. (Second edition) 1 / 25 Graphs: Basic Definitions Undirected Graph G(V, E): V is set of nodes (or vertices) and E is the

More information

Single Source Shortest Path

Single Source Shortest Path Single Source Shortest Path A directed graph G = (V, E) and a pair of nodes s, d is given. The edges have a real-valued weight W i. This time we are looking for the weight and the shortest path from s

More information

Single Source Shortest Paths

Single Source Shortest Paths Single Source Shortest Paths Given a connected weighted directed graph G(V, E), associated with each edge u, v E, there is a weight w(u, v). The single source shortest paths (SSSP) problem is to find a

More information

Shortest Path Problem

Shortest Path Problem Shortest Path Problem CLRS Chapters 24.1 3, 24.5, 25.2 Shortest path problem Shortest path problem (and variants) Properties of shortest paths Algorithmic framework Bellman-Ford algorithm Shortest paths

More information

CS473-Algorithms I. Lecture 14-A. Graph Searching: Breadth-First Search. Cevdet Aykanat - Bilkent University Computer Engineering Department

CS473-Algorithms I. Lecture 14-A. Graph Searching: Breadth-First Search. Cevdet Aykanat - Bilkent University Computer Engineering Department CS473-Algorithms I Lecture 14-A Graph Searching: Breadth-First Search 1 Graph Searching: Breadth-First Search Graph G =(V, E), directed or undirected with adjacency list repres. GOAL: Systematically explores

More information

Tutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u].

Tutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u]. Tutorial Question 1 A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first tree can also be used to classify the edges reachable from the source

More information

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019 CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction

More information

Taking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution

Taking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution Taking Stock IE170: Algorithms in Systems Engineering: Lecture 26 Jeff Linderoth Last Time Department of Industrial and Systems Engineering Lehigh University April 2, 2007 This Time Review! Jeff Linderoth

More information

Part VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths

Part VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths Part VI Graph algorithms Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths 1 Chapter 22 Elementary Graph Algorithms Representations of graphs

More information

Directed Graphs. DSA - lecture 5 - T.U.Cluj-Napoca - M. Joldos 1

Directed Graphs. DSA - lecture 5 - T.U.Cluj-Napoca - M. Joldos 1 Directed Graphs Definitions. Representations. ADT s. Single Source Shortest Path Problem (Dijkstra, Bellman-Ford, Floyd-Warshall). Traversals for DGs. Parenthesis Lemma. DAGs. Strong Components. Topological

More information

Graph Algorithms. Definition

Graph Algorithms. Definition Graph Algorithms Many problems in CS can be modeled as graph problems. Algorithms for solving graph problems are fundamental to the field of algorithm design. Definition A graph G = (V, E) consists of

More information

6.006 Introduction to Algorithms Spring 2008

6.006 Introduction to Algorithms Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Introduction to Algorithms:

More information

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity.

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity. 1. T F: Consider a directed graph G = (V, E) and a vertex s V. Suppose that for all v V, there exists a directed path in G from s to v. Suppose that a DFS is run on G, starting from s. Then, true or false:

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 04 Elementary Graph Algorithms (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu Introduction

More information

Outline. Graphs. Divide and Conquer.

Outline. Graphs. Divide and Conquer. GRAPHS COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Outline Graphs.

More information

Figure 1: A directed graph.

Figure 1: A directed graph. 1 Graphs A graph is a data structure that expresses relationships between objects. The objects are called nodes and the relationships are called edges. For example, social networks can be represented as

More information

Algorithm Design, Anal. & Imp., Homework 4 Solution

Algorithm Design, Anal. & Imp., Homework 4 Solution Algorithm Design, Anal. & Imp., Homework 4 Solution Note: The solution is for your personal use for this course. You are not allowed to post the solution in public place. There could be mistakes in the

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 07 Single-Source Shortest Paths (Chapter 24) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/36 Introduction

More information

Lecture 11: Analysis of Algorithms (CS ) 1

Lecture 11: Analysis of Algorithms (CS ) 1 Lecture 11: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 12, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 2 Dynamic Programming Approach Floyd-Warshall Shortest

More information

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College Laura Toma Algorithms (csci2200), Bowdoin College Topics Weighted graphs each edge (u, v) has a weight denoted w(u, v) or w uv stored in the adjacency list or adjacency matrix The weight of a path p =

More information

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 20. Example. Shortest Paths Definitions

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 20. Example. Shortest Paths Definitions Taking Stock IE170: Algorithms in Systems Engineering: Lecture 20 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 19, 2007 Last Time Minimum Spanning Trees Strongly

More information

Data Structures and Algorithms. Werner Nutt

Data Structures and Algorithms. Werner Nutt Data Structures and Algorithms Werner Nutt nutt@inf.unibz.it http://www.inf.unibz/it/~nutt Part 9 Academic Year 2011-2012 1 Acknowledgements & Copyright Notice These slides are built on top of slides developed

More information

Solutions to relevant spring 2000 exam problems

Solutions to relevant spring 2000 exam problems Problem 2, exam Here s Prim s algorithm, modified slightly to use C syntax. MSTPrim (G, w, r): Q = V[G]; for (each u Q) { key[u] = ; key[r] = 0; π[r] = 0; while (Q not empty) { u = ExtractMin (Q); for

More information

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24 /8/11 Single-Source Shortest Path Chapter 1 Shortest Paths Finding the shortest path between two nodes comes up in many applications o Transportation problems o Motion planning o Communication problems

More information

Graph. Vertex. edge. Directed Graph. Undirected Graph

Graph. Vertex. edge. Directed Graph. Undirected Graph Module : Graphs Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS E-mail: natarajan.meghanathan@jsums.edu Graph Graph is a data structure that is a collection

More information

Module 5 Graph Algorithms

Module 5 Graph Algorithms Module 5 Graph lgorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu 5. Graph Traversal lgorithms Depth First

More information

W4231: Analysis of Algorithms

W4231: Analysis of Algorithms W4231: Analysis of Algorithms 10/21/1999 Definitions for graphs Breadth First Search and Depth First Search Topological Sort. Graphs AgraphG is given by a set of vertices V and a set of edges E. Normally

More information

Algorithms. All-Pairs Shortest Paths. Dong Kyue Kim Hanyang University

Algorithms. All-Pairs Shortest Paths. Dong Kyue Kim Hanyang University Algorithms All-Pairs Shortest Paths Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr Contents Using single source shortest path algorithms Presents O(V 4 )-time algorithm, O(V 3 log V)-time algorithm,

More information

Konigsberg Bridge Problem

Konigsberg Bridge Problem Graphs Konigsberg Bridge Problem c C d g A Kneiphof e D a B b f c A C d e g D a b f B Euler s Graph Degree of a vertex: the number of edges incident to it Euler showed that there is a walk starting at

More information

Graph Algorithms (part 3 of CSC 282),

Graph Algorithms (part 3 of CSC 282), Graph Algorithms (part of CSC 8), http://www.cs.rochester.edu/~stefanko/teaching/10cs8 1 Schedule Homework is due Thursday, Oct 1. The QUIZ will be on Tuesday, Oct. 6. List of algorithms covered in the

More information

Shortest path problems

Shortest path problems Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths

More information

Trees and Graphs Shabsi Walfish NYU - Fundamental Algorithms Summer 2006

Trees and Graphs Shabsi Walfish NYU - Fundamental Algorithms Summer 2006 Trees and Graphs Basic Definitions Tree: Any connected, acyclic graph G = (V,E) E = V -1 n-ary Tree: Tree s/t all vertices of degree n+1 A root has degree n Binary Search Tree: A binary tree such that

More information

Graphs. CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington

Graphs. CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington Graphs CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington 1 Representation Adjacency matrix??adjacency lists?? Review Graphs (from CSE 2315)

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Data Structures and Algorithms. Chapter 7. Graphs

Data Structures and Algorithms. Chapter 7. Graphs 1 Data Structures and Algorithms Chapter 7 Werner Nutt 2 Acknowledgments The course follows the book Introduction to Algorithms, by Cormen, Leiserson, Rivest and Stein, MIT Press [CLRST]. Many examples

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms s of s Computer Science & Engineering 423/823 Design and Analysis of Lecture 03 (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 29 Spring 2010 s of s s are abstract data types that

More information

COL 702 : Assignment 1 solutions

COL 702 : Assignment 1 solutions COL 70 : Assignment 1 solutions 1(a ( n T (n = T + bn log n ( n = T + b n ( n log + bn log n ( n = T + b n ( n 8 log + b n log ( n + bn log n = bn log n + b n log n + bn log n +... log n terms = nb [(log

More information

Graph Traversal CSCI Algorithms I. Andrew Rosenberg

Graph Traversal CSCI Algorithms I. Andrew Rosenberg Graph Traversal CSCI 700 - Algorithms I Andrew Rosenberg Last Time Introduced Graphs Today Traversing a Graph A shortest path algorithm Example Graph We will use this graph as an example throughout today

More information

Review: Graph Theory and Representation

Review: Graph Theory and Representation Review: Graph Theory and Representation Graph Algorithms Graphs and Theorems about Graphs Graph implementation Graph Algorithms Shortest paths Minimum spanning tree What can graphs model? Cost of wiring

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 7 Greedy Graph Algorithms Topological sort Shortest paths Adam Smith The (Algorithm) Design Process 1. Work out the answer for some examples. Look for a general principle

More information

CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10

CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10 CS 220: Discrete Structures and their Applications graphs zybooks chapter 10 directed graphs A collection of vertices and directed edges What can this represent? undirected graphs A collection of vertices

More information

CS 270 Algorithms. Oliver Kullmann. Analysing BFS. Depth-first search. Analysing DFS. Dags and topological sorting.

CS 270 Algorithms. Oliver Kullmann. Analysing BFS. Depth-first search. Analysing DFS. Dags and topological sorting. General remarks Week 5 2 We finish, by analysing it. Then we consider the second main graph- algorithm, depth-first (). And we consider one application of, of graphs. Reading from CLRS for week 5 Chapter

More information

Chapter 25: All-Pairs Shortest-Paths

Chapter 25: All-Pairs Shortest-Paths Chapter : All-Pairs Shortest-Paths When no negative edges Some Algorithms Using Dijkstra s algorithm: O(V ) Using Binary heap implementation: O(VE lg V) Using Fibonacci heap: O(VE + V log V) When no negative

More information

Graph Theory. Many problems are mapped to graphs. Problems. traffic VLSI circuits social network communication networks web pages relationship

Graph Theory. Many problems are mapped to graphs. Problems. traffic VLSI circuits social network communication networks web pages relationship Graph Graph Usage I want to visit all the known famous places starting from Seoul ending in Seoul Knowledge: distances, costs Find the optimal(distance or cost) path Graph Theory Many problems are mapped

More information

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review 1 Review 1 Something I did not emphasize enough last time is that during the execution of depth-firstsearch, we construct depth-first-search trees. One graph may have multiple depth-firstsearch trees,

More information

Graph: representation and traversal

Graph: representation and traversal Graph: representation and traversal CISC5835, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Acknowledgement The set of slides have use materials from the following resources Slides for textbook

More information

Week 12: Minimum Spanning trees and Shortest Paths

Week 12: Minimum Spanning trees and Shortest Paths Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601

More information

CS 270 Algorithms. Oliver Kullmann. Breadth-first search. Analysing BFS. Depth-first. search. Analysing DFS. Dags and topological sorting.

CS 270 Algorithms. Oliver Kullmann. Breadth-first search. Analysing BFS. Depth-first. search. Analysing DFS. Dags and topological sorting. Week 5 General remarks and 2 We consider the simplest graph- algorithm, breadth-first (). We apply to compute shortest paths. Then we consider the second main graph- algorithm, depth-first (). And we consider

More information

Single Source Shortest Path (SSSP) Problem

Single Source Shortest Path (SSSP) Problem Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

Shortest Paths. Nishant Mehta Lectures 10 and 11

Shortest Paths. Nishant Mehta Lectures 10 and 11 Shortest Paths Nishant Mehta Lectures 0 and Communication Speeds in a Computer Network Find fastest way to route a data packet between two computers 6 Kbps 4 0 Mbps 6 6 Kbps 6 Kbps Gbps 00 Mbps 8 6 Kbps

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

Homework 2. Sample Solution. Due Date: Thursday, May 31, 11:59 pm

Homework 2. Sample Solution. Due Date: Thursday, May 31, 11:59 pm Homework Sample Solution Due Date: Thursday, May 31, 11:59 pm Directions: Your solutions should be typed and submitted as a single pdf on Gradescope by the due date. L A TEX is preferred but not required.

More information

Topological Sort. Version of October 11, Version of October 11, 2014 Topological Sort 1 / 14

Topological Sort. Version of October 11, Version of October 11, 2014 Topological Sort 1 / 14 Topological Sort Version of October 11, 2014 Version of October 11, 2014 Topological Sort 1 / 14 Directed Graph In a directed graph, we distinguish between edge (u, v) and edge (v, u) 6 3 0 1 2 9 4 Version

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Overview Problem A town has a set of houses and a set of roads. A road connects and only houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and

More information

Shortest Paths. Nishant Mehta Lectures 10 and 11

Shortest Paths. Nishant Mehta Lectures 10 and 11 Shortest Paths Nishant Mehta Lectures 0 and Finding the Fastest Way to Travel between Two Intersections in Vancouver Granville St and W Hastings St Homer St and W Hastings St 6 Granville St and W Pender

More information

Introductory Computer Programming: Shortest Path Algorithms

Introductory Computer Programming: Shortest Path Algorithms Introductory Computer Programming: 2017-18 Shortest Path Algorithms Soumik Purkayastha MD-1710 Contents 1 Project Proposal 1 2 Report 3 2.1 Introduction........................................ 3 2.2 Basic

More information

Topological Sort. Version of September 23, Version of September 23, 2016 Topological Sort 1 / 1

Topological Sort. Version of September 23, Version of September 23, 2016 Topological Sort 1 / 1 Topological Sort Version of September, 016 Version of September, 016 Topological Sort 1 / 1 Directed Graph In a directed graph, we distinguish between edge (u, v) and edge (v, u) 6 0 1 9 out-degree of

More information

Week 11: Minimum Spanning trees

Week 11: Minimum Spanning trees Week 11: Minimum Spanning trees Agenda: Minimum Spanning Trees Prim s Algorithm Reading: Textbook : 61-7 1 Week 11: Minimum Spanning trees Minimum spanning tree (MST) problem: Input: edge-weighted (simple,

More information

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico. Graph Algorithms Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico May, 0 CPD (DEI / IST) Parallel and Distributed Computing 0-0-0 / Outline

More information

CHAPTER 23: ELEMENTARY GRAPH ALGORITHMS Representations of graphs

CHAPTER 23: ELEMENTARY GRAPH ALGORITHMS Representations of graphs CHAPTER 23: ELEMENTARY GRAPH ALGORITHMS This chapter presents methods for representing a graph and for searching a graph. Searching a graph means systematically following the edges of the graph so as to

More information

csci 210: Data Structures Graph Traversals

csci 210: Data Structures Graph Traversals csci 210: Data Structures Graph Traversals Graph traversal (BFS and DFS) G can be undirected or directed We think about coloring each vertex WHITE before we start GRAY after we visit a vertex but before

More information

Graph Algorithms. Chapter 22. CPTR 430 Algorithms Graph Algorithms 1

Graph Algorithms. Chapter 22. CPTR 430 Algorithms Graph Algorithms 1 Graph Algorithms Chapter 22 CPTR 430 Algorithms Graph Algorithms Why Study Graph Algorithms? Mathematical graphs seem to be relatively specialized and abstract Why spend so much time and effort on algorithms

More information

Week 5. 1 Analysing BFS. 2 Depth-first search. 3 Analysing DFS. 4 Dags and topological sorting. 5 Detecting cycles. CS 270 Algorithms.

Week 5. 1 Analysing BFS. 2 Depth-first search. 3 Analysing DFS. 4 Dags and topological sorting. 5 Detecting cycles. CS 270 Algorithms. 1 2 Week 5 3 4 5 General remarks We finish, by analysing it. Then we consider the second main graph- algorithm, depth-first (). And we consider one application of, of graphs. Reading from CLRS for week

More information

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 17. Depth-First Search. DFS (Initialize and Go) Last Time Depth-First Search

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 17. Depth-First Search. DFS (Initialize and Go) Last Time Depth-First Search Taking Stock IE170: Algorithms in Systems Engineering: Lecture 17 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 2, 2007 Last Time Depth-First Search This Time:

More information

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs 2011 Pearson Addison-Wesley. All rights reserved 14 A-1 Terminology G = {V, E} A graph G consists of two sets A set V of vertices, or nodes A set E of edges A subgraph Consists of a subset

More information

CS420/520 Algorithm Analysis Spring 2009 Lecture 14

CS420/520 Algorithm Analysis Spring 2009 Lecture 14 CS420/520 Algorithm Analysis Spring 2009 Lecture 14 "A Computational Analysis of Alternative Algorithms for Labeling Techniques for Finding Shortest Path Trees", Dial, Glover, Karney, and Klingman, Networks

More information

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 16. Graph Search Algorithms. Recall BFS

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 16. Graph Search Algorithms. Recall BFS Taking Stock IE170: Algorithms in Systems Engineering: Lecture 16 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University February 28, 2007 Last Time The Wonderful World of This

More information

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018 CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018 Q1: Prove or disprove: You are given a connected undirected graph G = (V, E) with a weight function w defined over its

More information

Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M.

Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M. Lecture 9 Graphs Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M. Wootters (2017) 1 Graphs A graph is a set of vertices

More information

COMP 251 Winter 2017 Online quizzes with answers

COMP 251 Winter 2017 Online quizzes with answers COMP 251 Winter 2017 Online quizzes with answers Open Addressing (2) Which of the following assertions are true about open address tables? A. You cannot store more records than the total number of slots

More information