Graph Definitions. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function.

Similar documents
CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

Ma/CS 6b Class 5: Graph Connectivity

Graph Algorithms Using Depth First Search

Introduction to Algorithms

Introduction to Algorithms

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Problem Set 2 Solutions

Introduction to Algorithms

Vertex coloring, chromatic number

CSE 331: Introduction to Algorithm Analysis and Design Graphs

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

Math 776 Graph Theory Lecture Note 1 Basic concepts

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

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

Greedy algorithms is another useful way for solving optimization problems.

Trees. Arash Rafiey. 20 October, 2015

Ma/CS 6b Class 13: Counting Spanning Trees

1 Digraphs. Definition 1

CS200: Graphs. Rosen Ch , 9.6, Walls and Mirrors Ch. 14

Kruskal s MST Algorithm

Vertex coloring, chromatic number

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya

Ma/CS 6b Class 26: Art Galleries and Politicians

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

Module 7. Independent sets, coverings. and matchings. Contents

Notes for Recitation 8

Greedy Algorithms and Matroids. Andreas Klappenecker

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

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.

Greedy Algorithms and Matroids. Andreas Klappenecker

Ma/CS 6b Class 11: Kuratowski and Coloring

W4231: Analysis of Algorithms

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

Chordal Graphs: Theory and Algorithms

HW Graph Theory SOLUTIONS (hbovik) - Q

Math 170- Graph Theory Notes

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Discrete Wiskunde II. Lecture 6: Planar Graphs

Bayesian Networks, Winter Yoav Haimovitch & Ariel Raviv

Chapter 23. Minimum Spanning Trees

The Six Color Theorem

Problem Set 2 Solutions

Assignment # 4 Selected Solutions

Characterizations of Trees

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

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

Paths, Circuits, and Connected Graphs

Week 11: Minimum Spanning trees

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

2. CONNECTIVITY Connectivity

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

Math 454 Final Exam, Fall 2005

We ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

1 Matching in Non-Bipartite Graphs

Vertex Cover is Fixed-Parameter Tractable

by conservation of flow, hence the cancelation. Similarly, we have

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

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.

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

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

The k-center problem Approximation Algorithms 2009 Petros Potikas

Single Source Shortest Path

Advanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012

Chapter 9: Elementary Graph Algorithms Basic Graph Concepts

Lecture 4: Trees and Art Galleries

Lesson 22: Basic Graph Concepts

CS 2336 Discrete Mathematics

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

Greedy Algorithms and Matroids. Andreas Klappenecker

Matching Theory. Figure 1: Is this graph bipartite?

NOTE ON MINIMALLY k-connected GRAPHS

Chapter 3 Trees. Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

The Matrix-Tree Theorem and Its Applications to Complete and Complete Bipartite Graphs

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

Perfect matchings in O(nlogn) time in regular bipartite graph

Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs

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

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

Bipartite Roots of Graphs

Module 11. Directed Graphs. Contents

CMPSCI 311: Introduction to Algorithms Practice Final Exam

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

Professor: Padraic Bartlett. Lecture 9: Trees and Art Galleries. Week 10 UCSB 2015

6. Lecture notes on matroid intersection

1 Matchings in Graphs

Ma/CS 6b Class 4: Matchings in General Graphs

CMSC 380. Graph Terminology and Representation

Computability Theory

Math 15 - Spring Homework 2.6 Solutions 1. (2.6 # 20) The following graph has 45 vertices. In Sagemath, we can define it like so:

Minimum Spanning Tree

An Introduction to Graph Theory

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

{ 1} Definitions. 10. Extremal graph theory. Problem definition Paths and cycles Complete subgraphs

Steiner Trees and Forests

Lokale Netzstrukturen Exercise 5. Juli 19, 2017

Counting the number of spanning tree. Pied Piper Department of Computer Science and Engineering Shanghai Jiao Tong University

Transcription:

Graph Definitions Definition 1. (V,E) where An undirected graph G is a pair V is the set of vertices, E V 2 is the set of edges (unordered pairs) E = {(u, v) u, v V }. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function w : E R attaching a value (weight) to each edge. Typeset by FoilTEX 1

Definition 2. A path in a graph G =(V,E) is a sequence of vertices v 1,v 2,..., v k such that for 1 i k 1, (v i,v i+1 ) E. Definition 3. A cycle in a graph G =(V,E) is a path v 1,v 2,..., v k such that (v k,v 1 ) E. Definition 4. A tree is a graph with no cycles. Definition 5. A graph H =(V,E ) is a subgraph of G =(V,E) iff V V and E E. A spanning subgraph if V = V. Typeset by FoilTEX 2

Graph Representation Adjacency List: A link list for each vertex. The list contains a pointer to each neighbor of the vertex. (and a weight for weighted graph.) Total space O(V + E). Sequential (linear) access. Adjacency Matrix: A V V array, A[i, j] =1 iff (i, j) is an edge in the graph, otherwise A[i, j] =0. (A[i, j] =w i,j for weighted graph.) Total space O(V 2 ). Random access. Typeset by FoilTEX 3

Spanning Tree Given a graph G =(V,E) a spanning tree T in G is a subgraph of G that is connected; includes all the vertices of G; hasnocycles; Typeset by FoilTEX 4

Spanning Tree Characterization Theorem 1. A spanning tree T in a connected graph G =(V,E) is a maximal subgraph of G that is a tree (i.e. any edge added to T closes a cycle). Proof. Proof by contradiction: Assume that T is a spanning tree in G, and adding edge (v, u) to T does not close a cycle. There are paths from w to v, and from w to u using only edges of T (since it s a spanning tree). Thus, the path w to v, the edge (v, u) and the path u to w must include a cycle. Typeset by FoilTEX 5

The Size of a Spanning Tree Lemma 1. A spanning tree of a connected graph G =(V,E) has V 1 edges. Proof. Let T be a spanning tree of G. Fix a vertex w in T. There is a unique path from w to any other vertex in T. For all u V If an edge (u, v) was the last edge on the path from w to u direct the edge to u. This process gives a unique direction to each edge. Associate an edge with the vertex it is pointing to. We have a 1 1 correspondence between the edges of T and the set V {w}. Typeset by FoilTEX 6

Spanning Tree Algorithm Spanning Tree(G) 1. VT ; 2. ET ; 3. For i =1to E do 3.1 If {e i } ET has no cycles then 3.1.1. VT VT e i ; 3.1.2. ET ET {e i }; Typeset by FoilTEX 7

Correctness Theorem 2. tree in G. The algorithm computes a spanning Proof. The algorithm generates a maximal tree subgraph of G. Typeset by FoilTEX 8

Minimum Weighted Spanning Tree Given a graph G =(V,E) and a weight function w : E R (on the edges), a weight of a spanning tree T =(V,E(T )) is w(t ) = e E(T ) w(e). A minimum spanning tree of G with weight function w, is a spanning tree of G with minimum weight. Typeset by FoilTEX 9

Theorem 3. Let T =(V (T ),E(T)) be a minimum spanning tree of G. Let S = (V (S),E(S)) be a subgraph of T. Let e be an edge of minimum weight among all edges that do not close a cycle with edges in E(S), then E(S) {e}) is a subgraph of a minimum spanning tree of G. Proof. If e E(T ) we are done. Assume that e/ E(T ). Add the edge e to T,we get a cycle with at least one edge e E(S), thus w(e ) w(e). Let T =(V,E(T )+{e} {e }). T is a spanning tree, and w(t ) w(t ), therefore it is also a minimum spanning tree. Typeset by FoilTEX 10

Minimum Spanning Tree Algorithm Minimum Spanning Tree (G, w) 1. Q E; 2. E(T ) ; 3. V (T ) ; 4. For i =1to V 1 do 4.1 e Min(Q); 4.2 E(T ) E(T ) {e}; 4.3 V (T ) V (T ) vertices of e.; 4.4 Q Q {e}; 4.5 For all e Q 4.5.1. If e E(T ) close a cycle then Q Q {e}; Typeset by FoilTEX 11

Greedy Algorithm A greedy algorithm makes a sequence of local optimal choices. Under various conditions greedy construction is optimal, i.e. local optimal choices lead to global optimal solution, and there is no need for backtracking - but not always! Typeset by FoilTEX 12

Analysis Theorem 4. spanning tree. The algorithm constructs a minimum Proof. We prove by induction on the size of the set E(T ), that E(T ) is always a subset of a minimum spanning tree. The induction hypothesis holds for E(T )=. Assume that it holds for E(T ) = i 1, then by the above theorem and the choice of the algorithm the claim holds for E(T ) = i. Thus, also holds for E(T ) = V 1. Typeset by FoilTEX 13