CS213d Data Structures and Algorithms

Size: px
Start display at page:

Download "CS213d Data Structures and Algorithms"

Transcription

1 CS2d Data Structures and Algorithms Graphs-II Milind Sohoni IIT Bombay and IIT Dharwad March 7, 207 / 5

2 5,5M,5,5M 5,5M,5,5M 6 6 5,5M,5,5M 4,76 Belagavi 4,76 Hubballi Jn. 4,76 7,69 85 Shivamogga Town 5,,4 4,70 Amaravati Colony 5,,42 82 Chikkamagaluru 4, ,70,2,9 4,70 6,2,9 Vijayapura Hosapete Jn. 79 4, ,0,,2,,7 5,0,,,8 68 5,0,,,8 5,0,,,8 6 8 Mysuru Jn. 84 5,0,,, ,0, ,65,4 8 Tumakuru 70 5, ,6 0 24,92 8 5,74 6,0,9,6 Palani 62 7,,4,6 09 Raichur Ballari Jn ,7 4,7 4,7 4,7,6, ,72 7,6 7,6 26,08 2,9,4,9 58 Sri Pandurang Swami Road 4,7 4, ,0,6 9,46 7,9,50 04,4,9,6,7 6,72 6, , ,,05,05,4,9, ,46 25,07 7 6,0,6 Namakallu, ,46 7,50 8,57 8,57 Gadwal 8,57 8,60 29, ,86 20,87 9,90 Nandiyal Banaganapalli Nosam 96 Yerraguntla,94 8, ,8,50 9,8,5 Pattukottai 5 55a Mannargudi 67 9,90 0,05 8,97,0,5 56 7,8,50 9,8,5 2,2, , 7,8,48 8, ,5 88 2,2,86 2,22,99 54 Velankanni 88 20,29 8,97,,0,5 5 2,98 2,4 27, ,22,00 2,22,99 0,2,22 2,22, ,00 The Graph 5,, ,69 7,69 7, ,7 4,70 4,70 Nelamangala Bengaluru City,6,7,0, ,87 0,0 7,8, 7,6 7,6 March 7, / 5

3 Connected-ness For two vertices i, j V, we define the relation i j (and say that i is connected to j), if there is a path π = (v,..., v k ) such that v = i and v k = j. We also say that, there is a path from i to j. Lemma The relation on the vertices is an equivalence relation. MRJ(2) VSG(0) LD() UBL() JRU(5) BAY(4) RBB(6) March 7, 207 / 5

4 Proof Strategy Step I: If there is a trail π = (v,..., v n ), then there is a path µ = (w,..., w k ) such that v = w and v n = w k. Proof: Induction on n. Suppose that all vertices in π are distinct, then π is itself a path.. If not, suppose that v i = v j with i < j. Then construct the trail Now apply induction. π = (v,..., v i, v i, v j+,..., v n ) Step II. If v w and w x then there are paths π = (v = v,..., v k = w) and µ = (w = w,..., w r = x). Consider the trail: α = (v = v,..., v k = w,..., w r = x) This trail starts from v and ends at x. Now apply Step I above. This proves transitivity. Reflexivity and symmetry are easy. March 7, / 5

5 Distance Definition: If G(V, E) is a graph and v, w are vertices such that v w, then the distance d(v, w) is the length of the shortest path connecting v to w. If v w then we use d(v, w) =. Lemma For any vertices u, v, w V, we have d(u, v) + d(v, w) d(u, w). This is called the triangle inequality. Proof: Let π : u v implement d(u, v) and µ : v w implement d(v, w), then π µ is a trail from u to w. Thus, there is a path which is of the sum of the distances, or shorter. MRJ(2) VSG(0) LD() UBL() JRU(5) BAY(4) RBB(6) March 7, / 5

6 An application The minimum-change-over problem: For a railway network G(V, E), let π, π 2,..., π k be the paths of k trains in the network. Suppose that we want to go from station v to w with the fewest number of changes. Find the sequence of trains which will take me from v to w. MRJ(2) VSG(0) LD() UBL() JRU(5) BAY(4) RBB(6) Example: π = (2, ), π 2 = (0,,, 4), π = (, 5), π 4 = (4, 5, 6). Shortest route 2 6 is 2,,, 5, 6. Fewest changes π, π 2, π 6, i.e., 2,,, 4, 5, 6. March 7, / 5

7 The model Station-Train Graph: G (V, E ) defined as follows. (i) V is the stations of G. For v, v V, we say that (v, v ) is an edge if there is a train (say π i ) going from v to v. In which case, we put edata=i. MRJ(2) VSG(0) LD() UBL() JRU(5) BAY(4) RBB(6) Example: π = (2, ), π 2 = (0,,, 4), π = (, 5), π 4 = (4, 5, 6). Shortest route 2 6 is 2,,, 5, 6. Fewest changes π, π 2, π 6, i.e., 2,,, 4, 5, 6. Lemma: The shortest path µ from v to w in the train graph corresponds to the smallest sequence of changes. Prove. March 7, / 5

8 Shortening Loops Definition: For a graph G(V, E), let π = (v,..., v k ) be a loop. An index i is called a U-turn if v i = v i+. Lemma If π is a loop without U-turns then there is a subsequence µ of π which is a cycle. Problem. Given a sequence π check if π is a loop. Also, check if there is a subsequence µ of π which is a cycle. MRJ(2) VSG(0) LD() UBL() JRU(5) BAY(4) RBB(6) March 7, / 5

9 Connected components Each equivalence class is called a connected component of the graph. The graph is called connected if V is itself an (unique) equivalence class. Lemma Let G(V, E) be a graph, then V may be expresses as a disjoint union V = V... V k and E as a disjoint union E = E... E k, where E i ( V i ) 2, such that G(Vi, E i ) is connected, for all i. The quantity k is called the number of components of G. MRJ(2) 2 4 VSG(0) LD() UBL() RBB(6) JRU(5) BAY(4) 5 6 Connected Components: {,5}, {2,,6}, {4} March 7, / 5

10 Why connected components What happens if there is a transmission line failure? Which edges should be strengthened? How to put redundancy? March 7, / 5

11 Finding connected components Problem: Given a graph G(V, E), write a program to output its connected components. How do we output a connected component? As a bit vector [0 0 0 ] to denote {, 2, 5}. For a given vertex i, how do we find its connected component? Look at G.Vlist[i].eindex. Look at all tails of edges here. Then look at these vertices, and so on. Recursion?. vec[i]=; queue q; q.push(i); while (q.nos>0) { ii=q.pop(); get new neighbours jj of ii; vec[jj]=; q.push(jj);}; March 7, 207 / 5

12 Suppose we want to find all vertices connected with i for (j=0;j<g.n;j++) compo[j]=0; q.push(i); visited[i]=; while(!q.empty()) { jj=q.front(); q.pop(); // next vertex to be expande compo[jj]=; a=g.vlist[jj].eindex; if (a>=0){ k=a; while (G.Elist[k].head==jj&& k<2*g.m) { // push onto q when unvisited }; // of while };// of if a>0 };// of while q not empty March 7, / 5

13 Pushing onto the queue, if unvisited. kk=g.elist[k].tail; if (visited[kk]==0) { visited[kk]=; q.push(kk); cout << "pushing "<< kk << "\n"; }; k=k+; v queue VSG(0) MRJ(2) LD() UBL() RBB(6) JRU(5) BAY(4) March 7, 207 / 5

14 Some assertions (i) A phase begins with an empty stack and a vertex i which is unvisited.it begins with with an empty queue and i being pushed, and ends when the queue next gets empty. (ii) In this, there is a global visited which is updated and a compo which begins afresh. (iii) In each phase, there are several expansions, i.e., which begin with a pop and result in several vertices being added to the queue. (iv) For every vertex i which starts a phase, the vertices j which enter the queue in the phase are exactly the ones which (a) are labeled in compo, and (b) for which there is a path π i (j) from i to j. It is the last which needs proof. We prove by induction on the order in which the vertices enter the queue. March 7, / 5

15 Proof continued Clearly, when i enters, there is a path from i to i. A vertex kk enters the queue (i) during the expansion of jj which was already in the queue, and (ii) there was an edge (jj, kk). Thus, there already exists a path π i (jj) and π i (kk) = π i (jj) (jj, kk). But will every vertex in the connected component of i enter the queue? Let (i = v, v 2,..., v k, v k = kk) be a path i kk. Without loss of generality, we may assume that all v,..., v k are visited in the phase for i. Next, if v k has entered the queue, then clearly kk will be considered in the expansion of v k. Either it will enter the queue or kk was already visited!. March 7, / 5

16 Suppose we want to find the distance of all vertices connected to i for (j=0;j<g.n;j++) compo[j]=0; q.push(i); visited[i]=0; // distance is 0 while(!q.empty()) { jj=q.front(); q.pop(); // next vertex to be expande compo[jj]=; a=g.vlist[jj].eindex; if (a>=0){ k=a; while (G.Elist[k].head==jj&& k<2*g.m) { // update distance and push onto q }; // of while };// of if a>0 };// of while q not empty March 7, / 5

17 Pushing onto the queue, if unvisited. kk=g.elist[k].tail; if (visited[kk]==-) { visited[kk]=+visited[jj]; q.push(kk); cout << "pushing "<< kk << "\n"; }; k=k+; Output=[ ] MRJ(2) VSG(0) LD() UBL() JRU(5) BAY(4) RBB(6) Why does it work? March 7, / 5

18 If there is a path, there may be several shortest paths. If µ = (v = v, v 2,..., v r, v r = w) is a shortest path then µ a = (v,..., v a ) are all shortest paths to the respective vertices. Within a phase, at any moment in the queue (i) the distance vector of the elements are in increasing order, and (ii) no more than 2 consecutive numbers may appear. The path π i (jj) is of length visited[jj]. visited actually assigns the distance of a vertex from i, the leader of the phase. Again by induction, suppose that kk is at distance d and has been labeled r > d. Whence, there is a vertex jj at distance d which was labeled correctly. Whence kk would have been considered during the expansion of jj! See what happens when we change queue with a stack! March 7, / 5

19 An example bfs 6 dfs queue edges: (0,),(,2),(,8),(2,),(2,7),(8,9),(,4),(7,6),(4,5) stack edges: (0,),(,2),(,8),(8,7),(8,9),(7,6),(6,5),(5,4),(4,) March 7, / 5

20 Modeling The shortest-path algorithm (with a slight modification) also works for: Directed Graphs, i.e., where the edge may be only one-way. Edges with lengths, i.e., an edge may not be unit length but of some positive length. 5 2 Both of these give us lots of applications March 7, / 5

21 Application -room Guest-House Booking for period [,8]. arpit 5 usha srirang 4 7 om 2 4 baba 5 7 Maximize bookings. Service Graph: V = {b,..., b n }, bookings. E = {(b, b ) if b can follow b} u a 0 b s o cost(b,b ): number of days lost. Special start and end node. March 7, / 5

22 Application 2 The Professor Drop Problem : professors have to be dropped by a car which must start from IIT and come back to IIT. Find the shortest route for the car. This problem is called the Travelling Salesman Problem in literature. Let us see how to convert it into a shortest path problem. Note that this does not make the problem easier, it is just to show how to model! Let G(V, E) be the graph obtained by V = {0, a, b, c}, i.e., the locations of IIT, and the professors. Let d(v, w) be the length of the shortest route from v to w. 0 c 4 2 a b March 7, / 5

23 The layered model From this, we construct a gigantic graph GG(VV, EE), where VV is the collection of all partial sequences c 0ab 0abc a b 0a 0ac 0ba 0acb 0bac 0 0b 0bc 0bca 0c 0ca 0cab 0cb 0cba The Modeling Lesson Choice of vertices and edges important. What data to use and what problem to map to. March 7, / 5

24 Trees Definition. A graph G(V, E) is a tree if it is (i) connected, and (ii) acyclic, i.e., contains no cycles. (a) (b) (c) Recall: degree of a vertex is the number of edges coming out of it, i.e., the number of vertices adjacent to it. Lemma : If G(V, E) is a tree, then it has at least two vertices of degree. March 7, / 5

25 Proof: We choose v as the solitary vertex of degree, if there is only one such vertex, or an arbitrary vertex, if there is no vertex of degree. Next, we choose v 2 to be adjacent to v. We proceed thus, choosing v i+ to be adjacent to v i but distinct from v i. This can always be done since every v i with i 2 has degree at least 2. Since this sequence is potentially infinite, there must be a first r such that v r = v s, with s < r. Let us look at the sequence µ = (v s, v s+,..., v r, v r ). By the choice of r, there are no duplications in µ. Furthermore, every pair of adjacent vertices in the list actually make an edge. Thus µ is a cycle, which contradicts the hypothesis that G is acyclic. March 7, / 5

26 Proposition. (i) If G(V, E) is a tree then E = V. (ii) If G(V, E) is a connected graph with V edges, then it must be acyclic, and hence a tree. (iii) If G(V, E) is an acyclic graph with E = V edges, then it must be connected, and hence a tree. Proof: We prove this by induction on V. We know, by lemma, that there is a vertex v with only one edge e = (v, w) incident at v. Consider the graph G (V, E ) with V = V v, and E = E e. We claim that G is a tree. It is clearly acyclic, since E E and E allowed no cycles. What remains is to show that G is connected. For that, note that if x, y V, then x, y V as well. Since, G was connected, there was a path from π from x to y. We next argue that this path does not use the edge e, and thus lies completely in E. For if it did, then the path would terminate at v, since there is no exit from v. However, v V, and there v x, y. Thus π lies completely in E proving that x is connected to y in G. March 7, / 5

27 Thus G is a tree, and we have, inductively, E = V, which proves the same for G as well. Now we prove part (ii). First note that if α is a cycle in the graph G, and e α is an edge on the cycle, then G (V, E ) with E = E e is also connected. This is because any path using the edge e may now use the cycle α and go the other way. Whence, beginning with a connected graph G, we may sequentially delete edges from cycles, thus maintaining connectivity but reducing the number of edges. At some point this must stop and we will have a connected acyclic graph G (V, E ). Since G is then a tree, we have E = V = E. this means that G was acyclic to begin with. March 7, / 5

28 Finally, we prove (iii). Suppose G is not connected, we have, by lemma 4, a decomposition of G into its connected components. Whence, the identity E = V, tells us that G has a component G(V i, E i ) such that E i E i. Consequently, it is clear from part (i) that it cannot be a tree, and thus must contain a cycle. Thus G itself must contain a cycle, which contradicts the hypothesis. Definition: Given a connected graph G(V, E), a subset of edges E is called a spanning tree if G (V, E ) is a tree. March 7, / 5

29 An Example How do we know?. In this case, easy. ( 5 ) = 0. Two cycles of length. Thus 0 2 = 8. In General: The total is available through a deep theorem. March 7, / 5

30 bfs and dfs example Theorem: The edges printed by programs sptree or sptreestack give a spanning tree of G. These trees are called the breadth-first-search and depth-first-search respectively. jj=q.front(); q.pop()... kk=g.elist[k].tail; if (visited[kk]<0) { visited[kk]=+visited[jj]; q.push(kk); cout << "pushing "<< kk << "\n"; cout << "Edge ("<<jj << ","<< kk << ")\n"; }; k=k+; Proof : There are exactly n edges printed. Next, it is connected since π i (jj) is a path from i to every jj. March 7, / 5

31 Our Example bfs 6 dfs bfs edges: (0,),(,2),(,8),(2,),(2,7),(8,9),(,4),(7,6),(4,5) dfs edges: (0,),(,2),(,8),(8,7),(8,9),(7,6),(6,5),(5,4),(4,) Question: How do we detect if a given graph is a tree? Simple Answer: Check number of connected components, check number of edges. Deeper Answer: Does it have a non-tree edge? Check during expansion of a vertex. March 7, 207 / 5

32 sptree again jj=q.front(); q.pop()... kk=g.elist[k].tail; if (visited[kk]<0) { visited[kk]=+visited[jj]; q.push(kk); parent[kk]=j cout << "pushing "<< kk << "\n"; cout << "Edge ("<<jj << ","<< kk << ")\n"; }; if ((visited[kk]>=0)&&(parent[jj]!=kk) cout << "cycle detected\n"; k=k+; Can you print the cycle? March 7, / 5

33 Minimum Cost Spanning Trees Problem : Given a graph G(V, E) with edge costs, i.e., c : E R, find a spanning tree T E of minimum cost, i.e., c(t ) = e T c(e) is minimized March 7, 207 / 5

34 In Real Life March 7, / 5

35 March 7, / 5

CS213d Data Structures and Algorithms

CS213d Data Structures and Algorithms CS213d Data Structures and Algorithms Graphs-I Milind Sohoni IIT Bombay and IIT Dharwad February 8, 2017 1 / 30 5,5M,115,115M 5,5M,115,115M 16 16 5,5M,115,115M 14,76 Belagavi 14,76 Hubballi Jn. 14,76 17,69

More information

1 Variations of the Traveling Salesman Problem

1 Variations of the Traveling Salesman Problem Stanford University CS26: Optimization Handout 3 Luca Trevisan January, 20 Lecture 3 In which we prove the equivalence of three versions of the Traveling Salesman Problem, we provide a 2-approximate algorithm,

More information

Section 3.1: Nonseparable Graphs Cut vertex of a connected graph G: A vertex x G such that G x is not connected. Theorem 3.1, p. 57: Every connected

Section 3.1: Nonseparable Graphs Cut vertex of a connected graph G: A vertex x G such that G x is not connected. Theorem 3.1, p. 57: Every connected Section 3.1: Nonseparable Graphs Cut vertex of a connected graph G: A vertex x G such that G x is not connected. Theorem 3.1, p. 57: Every connected graph G with at least 2 vertices contains at least 2

More information

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1 Graph fundamentals Bipartite graph characterization Lemma. If a graph contains an odd closed walk, then it contains an odd cycle. Proof strategy: Consider a shortest closed odd walk W. If W is not a cycle,

More information

Chapter 3: Paths and Cycles

Chapter 3: Paths and Cycles Chapter 3: Paths and Cycles 5 Connectivity 1. Definitions: Walk: finite sequence of edges in which any two consecutive edges are adjacent or identical. (Initial vertex, Final vertex, length) Trail: walk

More information

Exercise set 2 Solutions

Exercise set 2 Solutions Exercise set 2 Solutions Let H and H be the two components of T e and let F E(T ) consist of the edges of T with one endpoint in V (H), the other in V (H ) Since T is connected, F Furthermore, since T

More information

Graph Representations and Traversal

Graph Representations and Traversal COMPSCI 330: Design and Analysis of Algorithms 02/08/2017-02/20/2017 Graph Representations and Traversal Lecturer: Debmalya Panigrahi Scribe: Tianqi Song, Fred Zhang, Tianyu Wang 1 Overview This lecture

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

Strongly connected: A directed graph is strongly connected if every pair of vertices are reachable from each other.

Strongly connected: A directed graph is strongly connected if every pair of vertices are reachable from each other. Directed Graph In a directed graph, each edge (u, v) has a direction u v. Thus (u, v) (v, u). Directed graph is useful to model many practical problems (such as one-way road in traffic network, and asymmetric

More information

Module 11: Additional Topics Graph Theory and Applications

Module 11: Additional Topics Graph Theory and Applications Module 11: Additional Topics Graph Theory and Applications Topics: Introduction to Graph Theory Representing (undirected) graphs Basic graph algorithms 1 Consider the following: Traveling Salesman Problem

More information

Lecture 8: PATHS, CYCLES AND CONNECTEDNESS

Lecture 8: PATHS, CYCLES AND CONNECTEDNESS Discrete Mathematics August 20, 2014 Lecture 8: PATHS, CYCLES AND CONNECTEDNESS Instructor: Sushmita Ruj Scribe: Ishan Sahu & Arnab Biswas 1 Paths, Cycles and Connectedness 1.1 Paths and Cycles 1. Paths

More information

Matching Theory. Figure 1: Is this graph bipartite?

Matching Theory. Figure 1: Is this graph bipartite? Matching Theory 1 Introduction A matching M of a graph is a subset of E such that no two edges in M share a vertex; edges which have this property are called independent edges. A matching M is said to

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

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

Graph traversal is a generalization of tree traversal except we have to keep track of the visited vertices.

Graph traversal is a generalization of tree traversal except we have to keep track of the visited vertices. Traversal Techniques for Graphs Graph traversal is a generalization of tree traversal except we have to keep track of the visited vertices. Applications: Strongly connected components, topological sorting,

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

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

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

CSE 331: Introduction to Algorithm Analysis and Design Graphs

CSE 331: Introduction to Algorithm Analysis and Design Graphs CSE 331: Introduction to Algorithm Analysis and Design Graphs 1 Graph Definitions Graph: A graph consists of a set of verticies V and a set of edges E such that: G = (V, E) V = {v 0, v 1,..., v n 1 } E

More information

csci 210: Data Structures Stacks and Queues in Solution Searching

csci 210: Data Structures Stacks and Queues in Solution Searching csci 210: Data Structures Stacks and Queues in Solution Searching 1 Summary Topics Using Stacks and Queues in searching Applications: In-class problem: missionary and cannibals In-class problem: finding

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

9.5 Equivalence Relations

9.5 Equivalence Relations 9.5 Equivalence Relations You know from your early study of fractions that each fraction has many equivalent forms. For example, 2, 2 4, 3 6, 2, 3 6, 5 30,... are all different ways to represent the same

More information

Topic 10 Part 2 [474 marks]

Topic 10 Part 2 [474 marks] Topic Part 2 [474 marks] The complete graph H has the following cost adjacency matrix Consider the travelling salesman problem for H a By first finding a minimum spanning tree on the subgraph of H formed

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

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises...

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises... Modules 6 Hamilton Graphs (4-8 lectures) 135 6.1 Introduction................................ 136 6.2 Necessary conditions and sufficient conditions............. 137 Exercises..................................

More information

Definition 1 (Hand-shake model). A hand shake model is an incidence geometry for which every line has exactly two points.

Definition 1 (Hand-shake model). A hand shake model is an incidence geometry for which every line has exactly two points. Math 3181 Dr. Franz Rothe Name: All3181\3181_spr13t1.tex 1 Solution of Test I Definition 1 (Hand-shake model). A hand shake model is an incidence geometry for which every line has exactly two points. Definition

More information

Trees. Arash Rafiey. 20 October, 2015

Trees. Arash Rafiey. 20 October, 2015 20 October, 2015 Definition Let G = (V, E) be a loop-free undirected graph. G is called a tree if G is connected and contains no cycle. Definition Let G = (V, E) be a loop-free undirected graph. G is called

More information

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph Graphs and Trees Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) who is connected to whom Web search views web pages as a graph Who points to whom Niche graphs (Ecology):

More information

LECTURE 17 GRAPH TRAVERSALS

LECTURE 17 GRAPH TRAVERSALS DATA STRUCTURES AND ALGORITHMS LECTURE 17 GRAPH TRAVERSALS IMRAN IHSAN ASSISTANT PROFESSOR AIR UNIVERSITY, ISLAMABAD STRATEGIES Traversals of graphs are also called searches We can use either breadth-first

More information

Fixed-Parameter Algorithms, IA166

Fixed-Parameter Algorithms, IA166 Fixed-Parameter Algorithms, IA166 Sebastian Ordyniak Faculty of Informatics Masaryk University Brno Spring Semester 2013 Introduction Outline 1 Introduction Algorithms on Locally Bounded Treewidth Layer

More information

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE Professor Kindred Math 104, Graph Theory Homework 3 Solutions February 14, 2013 Introduction to Graph Theory, West Section 2.1: 37, 62 Section 2.2: 6, 7, 15 Section 2.3: 7, 10, 14 DO NOT RE-DISTRIBUTE

More information

Module 11. Directed Graphs. Contents

Module 11. Directed Graphs. Contents Module 11 Directed Graphs Contents 11.1 Basic concepts......................... 256 Underlying graph of a digraph................ 257 Out-degrees and in-degrees.................. 258 Isomorphism..........................

More information

Announcements. HW3 is graded. Average is 81%

Announcements. HW3 is graded. Average is 81% CSC263 Week 9 Announcements HW3 is graded. Average is 81% Announcements Problem Set 4 is due this Tuesday! Due Tuesday (Nov 17) Recap The Graph ADT definition and data structures BFS gives us single-source

More information

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings On the Relationships between Zero Forcing Numbers and Certain Graph Coverings Fatemeh Alinaghipour Taklimi, Shaun Fallat 1,, Karen Meagher 2 Department of Mathematics and Statistics, University of Regina,

More information

Discharging and reducible configurations

Discharging and reducible configurations Discharging and reducible configurations Zdeněk Dvořák March 24, 2018 Suppose we want to show that graphs from some hereditary class G are k- colorable. Clearly, we can restrict our attention to graphs

More information

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge. 1 Graph Basics What is a graph? Graph: a graph G consists of a set of vertices, denoted V (G), a set of edges, denoted E(G), and a relation called incidence so that each edge is incident with either one

More information

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus) Math 30 Introduction to Proofs via Number Theory Robert Jewett (with small modifications by B. Ćurgus) March 30, 009 Contents 1 The Integers 3 1.1 Axioms of Z...................................... 3 1.

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

K 4 C 5. Figure 4.5: Some well known family of graphs

K 4 C 5. Figure 4.5: Some well known family of graphs 08 CHAPTER. TOPICS IN CLASSICAL GRAPH THEORY K, K K K, K K, K K, K C C C C 6 6 P P P P P. Graph Operations Figure.: Some well known family of graphs A graph Y = (V,E ) is said to be a subgraph of a graph

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

Rigidity, connectivity and graph decompositions

Rigidity, connectivity and graph decompositions First Prev Next Last Rigidity, connectivity and graph decompositions Brigitte Servatius Herman Servatius Worcester Polytechnic Institute Page 1 of 100 First Prev Next Last Page 2 of 100 We say that a framework

More information

HW Graph Theory SOLUTIONS (hbovik)

HW Graph Theory SOLUTIONS (hbovik) Diestel 1.3: Let G be a graph containing a cycle C, and assume that G contains a path P of length at least k between two vertices of C. Show that G contains a cycle of length at least k. If C has length

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

5.1 Min-Max Theorem for General Matching

5.1 Min-Max Theorem for General Matching CSC5160: Combinatorial Optimization and Approximation Algorithms Topic: General Matching Date: 4/01/008 Lecturer: Lap Chi Lau Scribe: Jennifer X.M. WU In this lecture, we discuss matchings in general graph.

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

Discrete mathematics , Fall Instructor: prof. János Pach

Discrete mathematics , Fall Instructor: prof. János Pach Discrete mathematics 2016-2017, Fall Instructor: prof. János Pach - covered material - Lecture 1. Counting problems To read: [Lov]: 1.2. Sets, 1.3. Number of subsets, 1.5. Sequences, 1.6. Permutations,

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

Betweenness and the Crossbar Theorem. Lemma: Let A, B, and C be distinct points. If A*B*C, then neither A*C*B nor B*A*C.

Betweenness and the Crossbar Theorem. Lemma: Let A, B, and C be distinct points. If A*B*C, then neither A*C*B nor B*A*C. Betweenness and the Crossbar Theorem Lemma: Let A, B, and C be distinct points. If A*B*C, then neither A*C*B nor B*A*C. Suppose that both A*B*C and A*C*B. Thus AB+BC =AC, and AC +CB = AB. From this we

More information

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CHAPTER 8. Copyright Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation

More information

Name: Lirong TAN 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G.

Name: Lirong TAN 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G. 1. (15 pts) (a) Define what is a shortest s-t path in a weighted, connected graph G. A shortest s-t path is a path from vertex to vertex, whose sum of edge weights is minimized. (b) Give the pseudocode

More information

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points MC 0 GRAPH THEORY 0// Solutions to HW # 0 points + XC points ) [CH] p.,..7. This problem introduces an important class of graphs called the hypercubes or k-cubes, Q, Q, Q, etc. I suggest that before you

More information

1 Connected components in undirected graphs

1 Connected components in undirected graphs Lecture 10 Connected components of undirected and directed graphs Scribe: Luke Johnston (2016) and Mary Wootters (2017) Date: October 25, 2017 Much of the following notes were taken from Tim Roughgarden

More information

Some Upper Bounds for Signed Star Domination Number of Graphs. S. Akbari, A. Norouzi-Fard, A. Rezaei, R. Rotabi, S. Sabour.

Some Upper Bounds for Signed Star Domination Number of Graphs. S. Akbari, A. Norouzi-Fard, A. Rezaei, R. Rotabi, S. Sabour. Some Upper Bounds for Signed Star Domination Number of Graphs S. Akbari, A. Norouzi-Fard, A. Rezaei, R. Rotabi, S. Sabour Abstract Let G be a graph with the vertex set V (G) and edge set E(G). A function

More information

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC January 26, 2011

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC   January 26, 2011 Graph Theory Martin Stynes Department of Mathematics, UCC email: m.stynes@ucc.ie January 26, 2011 1 Introduction to Graphs 1 A graph G = (V, E) is a non-empty set of nodes or vertices V and a (possibly

More information

r=1 The Binomial Theorem. 4 MA095/98G Revision

r=1 The Binomial Theorem. 4 MA095/98G Revision Revision Read through the whole course once Make summary sheets of important definitions and results, you can use the following pages as a start and fill in more yourself Do all assignments again Do the

More information

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d Greedy Algorithms 1 Simple Knapsack Problem Greedy Algorithms form an important class of algorithmic techniques. We illustrate the idea by applying it to a simplified version of the Knapsack Problem. Informally,

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

Faster parameterized algorithms for Minimum Fill-In

Faster parameterized algorithms for Minimum Fill-In Faster parameterized algorithms for Minimum Fill-In Hans L. Bodlaender Pinar Heggernes Yngve Villanger Abstract We present two parameterized algorithms for the Minimum Fill-In problem, also known as Chordal

More information

Parallel Breadth First Search

Parallel Breadth First Search CSE341T/CSE549T 11/03/2014 Lecture 18 Parallel Breadth First Search Today, we will look at a basic graph algorithm, breadth first search (BFS). BFS can be applied to solve a variety of problems including:

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

The External Network Problem

The External Network Problem The External Network Problem Jan van den Heuvel and Matthew Johnson CDAM Research Report LSE-CDAM-2004-15 December 2004 Abstract The connectivity of a communications network can often be enhanced if the

More information

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck Theory of Computing Lecture 10 MAS 714 Hartmut Klauck Seven Bridges of Königsberg Can one take a walk that crosses each bridge exactly once? Seven Bridges of Königsberg Model as a graph Is there a path

More information

Theory of Computing. Lecture 4/5 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 4/5 MAS 714 Hartmut Klauck Theory of Computing Lecture 4/5 MAS 714 Hartmut Klauck How fast can we sort? There are deterministic algorithms that sort in worst case time O(n log n) Do better algorithms exist? Example [Andersson et

More information

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1.

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1. Lecturer: Scribe: Meena Mahajan Rajesh Chitnis Matchings in Graphs Meeting: 1 6th Jan 010 Most of the material in this lecture is taken from the book Fast Parallel Algorithms for Graph Matching Problems

More information

1 The Shortest Path Problem

1 The Shortest Path Problem CS161 Lecture 11 Single Source Shortest Paths Scribed by: Romil Verma (2015), Virginia Date: May 8, 2016 1 The Shortest Path Problem In this lecture, we ll discuss the shortest path problem. Assume we

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

Lecture 10 Graph algorithms: testing graph properties

Lecture 10 Graph algorithms: testing graph properties Lecture 10 Graph algorithms: testing graph properties COMP 523: Advanced Algorithmic Techniques Lecturer: Dariusz Kowalski Lecture 10: Testing Graph Properties 1 Overview Previous lectures: Representation

More information

2 Geometry Solutions

2 Geometry Solutions 2 Geometry Solutions jacques@ucsd.edu Here is give problems and solutions in increasing order of difficulty. 2.1 Easier problems Problem 1. What is the minimum number of hyperplanar slices to make a d-dimensional

More information

Understand graph terminology Implement graphs using

Understand graph terminology Implement graphs using raphs Understand graph terminology Implement graphs using djacency lists and djacency matrices Perform graph searches Depth first search Breadth first search Perform shortest-path algorithms Disjkstra

More information

Bounds on distances for spanning trees of graphs. Mr Mthobisi Luca Ntuli

Bounds on distances for spanning trees of graphs. Mr Mthobisi Luca Ntuli Bounds on distances for spanning trees of graphs Mr Mthobisi Luca Ntuli March 8, 2018 To Mphemba Legacy iii Acknowledgments I would like to thank my supervisors, Dr MJ Morgan and Prof S Mukwembi. It

More information

Solution for Homework set 3

Solution for Homework set 3 TTIC 300 and CMSC 37000 Algorithms Winter 07 Solution for Homework set 3 Question (0 points) We are given a directed graph G = (V, E), with two special vertices s and t, and non-negative integral capacities

More information

CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Dan Grossman Fall 2013

CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Dan Grossman Fall 2013 CSE373: Data Structures & Algorithms Lecture 7: Minimum Spanning Trees Dan Grossman Fall 03 Spanning Trees A simple problem: Given a connected undirected graph G=(V,E), find a minimal subset of edges such

More information

Fundamental Properties of Graphs

Fundamental Properties of Graphs Chapter three In many real-life situations we need to know how robust a graph that represents a certain network is, how edges or vertices can be removed without completely destroying the overall connectivity,

More information

implementing the breadth-first search algorithm implementing the depth-first search algorithm

implementing the breadth-first search algorithm implementing the depth-first search algorithm Graph Traversals 1 Graph Traversals representing graphs adjacency matrices and adjacency lists 2 Implementing the Breadth-First and Depth-First Search Algorithms implementing the breadth-first search algorithm

More information

Faster parameterized algorithms for Minimum Fill-In

Faster parameterized algorithms for Minimum Fill-In Faster parameterized algorithms for Minimum Fill-In Hans L. Bodlaender Pinar Heggernes Yngve Villanger Technical Report UU-CS-2008-042 December 2008 Department of Information and Computing Sciences Utrecht

More information

Approximation Algorithms

Approximation Algorithms Chapter 8 Approximation Algorithms Algorithm Theory WS 2016/17 Fabian Kuhn Approximation Algorithms Optimization appears everywhere in computer science We have seen many examples, e.g.: scheduling jobs

More information

Theorem 2.9: nearest addition algorithm

Theorem 2.9: nearest addition algorithm There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used

More information

Graph Algorithms Using Depth First Search

Graph Algorithms Using Depth First Search Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth

More information

Notes for Recitation 9

Notes for Recitation 9 6.042/18.062J Mathematics for Computer Science October 8, 2010 Tom Leighton and Marten van Dijk Notes for Recitation 9 1 Traveling Salesperson Problem Now we re going to talk about a famous optimization

More information

Discrete mathematics II. - Graphs

Discrete mathematics II. - Graphs Emil Vatai April 25, 2018 Basic definitions Definition of an undirected graph Definition (Undirected graph) An undirected graph or (just) a graph is a triplet G = (ϕ, E, V ), where V is the set of vertices,

More information

Lecture 8: The Traveling Salesman Problem

Lecture 8: The Traveling Salesman Problem Lecture 8: The Traveling Salesman Problem Let G = (V, E) be an undirected graph. A Hamiltonian cycle of G is a cycle that visits every vertex v V exactly once. Instead of Hamiltonian cycle, we sometimes

More information

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition. 18.433 Combinatorial Optimization Matching Algorithms September 9,14,16 Lecturer: Santosh Vempala Given a graph G = (V, E), a matching M is a set of edges with the property that no two of the edges have

More information

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G. MAD 3105 Spring 2006 Solutions for Review for Test 2 1. Define a graph G with V (G) = {a, b, c, d, e}, E(G) = {r, s, t, u, v, w, x, y, z} and γ, the function defining the edges, is given by the table ɛ

More information

CS 6783 (Applied Algorithms) Lecture 5

CS 6783 (Applied Algorithms) Lecture 5 CS 6783 (Applied Algorithms) Lecture 5 Antonina Kolokolova January 19, 2012 1 Minimum Spanning Trees An undirected graph G is a pair (V, E); V is a set (of vertices or nodes); E is a set of (undirected)

More information

Problem Set 7 Solutions

Problem Set 7 Solutions " [ Introduction to Algorithms November 29, 200 Massachusetts Institute of Technology 6046J/18410J Professors Shafi Goldwasser and Silvio Micali Handout 27 Problem Set 7 Solutions Problem 7-1 Shortest

More information

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE Professor Kindred Math 104, Graph Theory Homework 2 Solutions February 7, 2013 Introduction to Graph Theory, West Section 1.2: 26, 38, 42 Section 1.3: 14, 18 Section 2.1: 26, 29, 30 DO NOT RE-DISTRIBUTE

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

e-pg PATHSHALA- Computer Science Design and Analysis of Algorithms Module 14 Component-I (A) - Personal Details

e-pg PATHSHALA- Computer Science Design and Analysis of Algorithms Module 14 Component-I (A) - Personal Details e-pg PATHSHALA- Computer Science Design and Analysis of Algorithms Module 14 Component-I (A) - Personal Details Role Name Designation Principal Investigator Dr.T.V.Geetha Senior Professor, Department of

More information

Lecture 10,11: General Matching Polytope, Maximum Flow. 1 Perfect Matching and Matching Polytope on General Graphs

Lecture 10,11: General Matching Polytope, Maximum Flow. 1 Perfect Matching and Matching Polytope on General Graphs CMPUT 675: Topics in Algorithms and Combinatorial Optimization (Fall 2009) Lecture 10,11: General Matching Polytope, Maximum Flow Lecturer: Mohammad R Salavatipour Date: Oct 6 and 8, 2009 Scriber: Mohammad

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. Directed

More information

Notes for Recitation 8

Notes for Recitation 8 6.04/8.06J Mathematics for Computer Science October 5, 00 Tom Leighton and Marten van Dijk Notes for Recitation 8 Build-up error Recall a graph is connected iff there is a path between every pair of its

More information

Math 776 Graph Theory Lecture Note 1 Basic concepts

Math 776 Graph Theory Lecture Note 1 Basic concepts Math 776 Graph Theory Lecture Note 1 Basic concepts Lectured by Lincoln Lu Transcribed by Lincoln Lu Graph theory was founded by the great Swiss mathematician Leonhard Euler (1707-178) after he solved

More information

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial. 2301-670 Graph theory 1.1 What is a graph? 1 st semester 2550 1 1.1. What is a graph? 1.1.2. Definition. A graph G is a triple (V(G), E(G), ψ G ) consisting of V(G) of vertices, a set E(G), disjoint from

More information

Foundations of Computer Science Spring Mathematical Preliminaries

Foundations of Computer Science Spring Mathematical Preliminaries Foundations of Computer Science Spring 2017 Equivalence Relation, Recursive Definition, and Mathematical Induction Mathematical Preliminaries Mohammad Ashiqur Rahman Department of Computer Science College

More information

2. CONNECTIVITY Connectivity

2. CONNECTIVITY Connectivity 2. CONNECTIVITY 70 2. Connectivity 2.1. Connectivity. Definition 2.1.1. (1) A path in a graph G = (V, E) is a sequence of vertices v 0, v 1, v 2,..., v n such that {v i 1, v i } is an edge of G for i =

More information

Graph Algorithms. Andreas Klappenecker. [based on slides by Prof. Welch]

Graph Algorithms. Andreas Klappenecker. [based on slides by Prof. Welch] Graph Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Directed Graphs Let V be a finite set and E a binary relation on V, that is, E VxV. Then the pair G=(V,E) is called a directed graph.

More information

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}. Greedy Algorithms 1 Simple Knapsack Problem Greedy Algorithms form an important class of algorithmic techniques. We illustrate the idea by applying it to a simplified version of the Knapsack Problem. Informally,

More information

Topics in Combinatorial Optimization February 5, Lecture 2

Topics in Combinatorial Optimization February 5, Lecture 2 8.997 Topics in Combinatorial Optimization February 5, 2004 Lecture 2 Lecturer: Michel X. Goemans Scribe: Robert Kleinberg In this lecture, we will: Present Edmonds algorithm for computing a maximum matching

More information

Lecture 7. s.t. e = (u,v) E x u + x v 1 (2) v V x v 0 (3)

Lecture 7. s.t. e = (u,v) E x u + x v 1 (2) v V x v 0 (3) COMPSCI 632: Approximation Algorithms September 18, 2017 Lecturer: Debmalya Panigrahi Lecture 7 Scribe: Xiang Wang 1 Overview In this lecture, we will use Primal-Dual method to design approximation algorithms

More information

Paths, Circuits, and Connected Graphs

Paths, Circuits, and Connected Graphs Paths, Circuits, and Connected Graphs Paths and Circuits Definition: Let G = (V, E) be an undirected graph, vertices u, v V A path of length n from u to v is a sequence of edges e i = {u i 1, u i} E for

More information