Ngày 20 tháng 7 năm Discrete Optimization Graphs

Similar documents
Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

Connection MATH Connection. Benjamin V.C. Collins, James A. Swenson MATH 2730

GRAPH ALGORITHMS Week 3 (16-21 October 2017)

CS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT UNIT V GRAPHS

Breadth First Search, Dijkstra s Algorithm for Shortest Paths

Hamiltonian Graphs Graphs

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows

The Signless Laplacian Spectral Radius of Graphs with Given Degree Sequences. Dedicated to professor Tian Feng on the occasion of his 70 birthday

1 Hamiltonian properties

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

Graph G = (V, E). V ={vertices}, E={edges}. V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Directed Graphs (Digraphs) and Graphs

Lecture 13: Spectral Graph Theory

Algorithms and Theory of Computation. Lecture 13: Linear Programming (2)

Introduction to Algorithms

Scribes: Po-Hsuan Wei, William Kuzmaul Editor: Kevin Wu Date: October 18, 2016

Introduction to Algorithms

More on NP and Reductions

Eulerian Subgraphs in Graphs with Short Cycles

Exam EDAF May 2011, , Vic1. Thore Husfeldt

Combinatorial optimization problems

Graph fundamentals. Matrices associated with a graph

Ring Sums, Bridges and Fundamental Sets

Question Paper Code :

Lecture 1: Graphs, Adjacency Matrices, Graph Laplacian

The Max Flow Problem

Uniform Star-factors of Graphs with Girth Three

MAS210 Graph Theory Exercises 5 Solutions (1) v 5 (1)

1 Maximum Budgeted Allocation

Introduction to Algorithms

Ma/CS 6b Class 23: Eigenvalues in Regular Graphs

Course : Algebraic Combinatorics

2 hours THE UNIVERSITY OF MANCHESTER. 6 June :45 11:45

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro.

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

Fundamental Algorithms 11

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

Single Source Shortest Paths

arxiv: v1 [math.co] 13 May 2016

Exam EDAF August Thore Husfeldt

All-Pairs Shortest Paths

Discrete Optimization 2010 Lecture 3 Maximum Flows

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

Lecture 19: NP-Completeness 1

5 Flows and cuts in digraphs

Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic).

Graphic sequences, adjacency matrix

UNIVERSITY OF YORK. MSc Examinations 2004 MATHEMATICS Networks. Time Allowed: 3 hours.

THE NUMBER OF INDEPENDENT DOMINATING SETS OF LABELED TREES. Changwoo Lee. 1. Introduction

Maximum Flow Problem (Ford and Fulkerson, 1956)

Martin Milanič

Laplacian spectral radius of trees with given maximum degree

Single Source Shortest Paths

Maximum flow problem (part I)

Practice Final Solutions. 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) { 2 j = 0 3 if (n = 0) { 4 return j

R(p, k) = the near regular complete k-partite graph of order p. Let p = sk+r, where s and r are positive integers such that 0 r < k.

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms

Balanced Allocation Through Random Walk

Hamiltonicity in Connected Regular Graphs

Query Processing in Spatial Network Databases

2. A vertex in G is central if its greatest distance from any other vertex is as small as possible. This distance is the radius of G.

18.312: Algebraic Combinatorics Lionel Levine. Lecture 19

CS5314 Randomized Algorithms. Lecture 18: Probabilistic Method (De-randomization, Sample-and-Modify)

ON DOMINATING THE CARTESIAN PRODUCT OF A GRAPH AND K 2. Bert L. Hartnell

Computing the Domination Number of Grid Graphs

A walk over the shortest path: Dijkstra s Algorithm viewed as fixed-point computation

Linear-Time Algorithms for Finding Tucker Submatrices and Lekkerkerker-Boland Subgraphs

Sublinear Algorithms Lecture 3. Sofya Raskhodnikova Penn State University

An Introduction to Spectral Graph Theory

Recall: Matchings. Examples. K n,m, K n, Petersen graph, Q k ; graphs without perfect matching

The super line graph L 2

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

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

Informatique Fondamentale IMA S8

Algorithms and Data Structures (COMP 251) Midterm Solutions

1.3 Vertex Degrees. Vertex Degree for Undirected Graphs: Let G be an undirected. Vertex Degree for Digraphs: Let D be a digraph and y V (D).

HOMEWORK #2 - MATH 3260

Linear Algebra and its Applications

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

Probability & Combinatorics Test and Solutions February 18, 2012

Discrete Mathematics

DEGREE SEQUENCES OF INFINITE GRAPHS

Determinant of the distance matrix of a tree with matrix weights

Hamiltonian paths in tournaments A generalization of sorting DM19 notes fall 2006

(c) Give a proof of or a counterexample to the following statement: (3n 2)= n(3n 1) 2

Nowhere 0 mod p dominating sets in multigraphs

Learning Algorithms with Unified and Interactive Web-Based Visualization

Lecture 4. 1 Estimating the number of connected components and minimum spanning tree

Algorithms: Lecture 12. Chalmers University of Technology

Basic graph theory 18.S995 - L26.

40th International Mathematical Olympiad

Out-colourings of Digraphs

Paths and cycles in extended and decomposable digraphs

4 Packing T-joins and T-cuts

Cographs; chordal graphs and tree decompositions

Standard Diraphs the (unique) digraph with no vertices or edges. (modulo n) for every 1 i n A digraph whose underlying graph is a complete graph.

Duality of LPs and Applications

Packing and decomposition of graphs with trees

Remarks on dynamic load balancing of integer loads and integral graphs

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

Transcription:

Discrete Optimization Graphs Ngày 20 tháng 7 năm 2011

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations.

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations. Theorem (6-1) Let d(v 1 ), d(v 2 ),..., d(v n ) be the degree sequence of the vertices of the graph G(V, E). Then n i=1 d(v i) = 2 E.

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations. Theorem (6-1) Let d(v 1 ), d(v 2 ),..., d(v n ) be the degree sequence of the vertices of the graph G(V, E). Then n i=1 d(v i) = 2 E. Observation

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations. Theorem (6-1) Let d(v 1 ), d(v 2 ),..., d(v n ) be the degree sequence of the vertices of the graph G(V, E). Then n i=1 d(v i) = 2 E. Observation If d G (v) 2 v V (G) then G contains cycles.

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations. Theorem (6-1) Let d(v 1 ), d(v 2 ),..., d(v n ) be the degree sequence of the vertices of the graph G(V, E). Then n i=1 d(v i) = 2 E. Observation If d G (v) 2 v V (G) then G contains cycles. Corolary (6-2) A tree has vertices of degree 1. Such vertices are called leaves.

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations. Theorem (6-1) Let d(v 1 ), d(v 2 ),..., d(v n ) be the degree sequence of the vertices of the graph G(V, E). Then n i=1 d(v i) = 2 E. Observation If d G (v) 2 v V (G) then G contains cycles. Corolary (6-2) A tree has vertices of degree 1. Such vertices are called leaves. If G is a connected graph and d G (v i ) = 1 then G \ {v i } remains connected.

Lecture 6: Graphs In this class we shall prove some simple, useful theorems about graphs. We start with very simple obseravations. Theorem (6-1) Let d(v 1 ), d(v 2 ),..., d(v n ) be the degree sequence of the vertices of the graph G(V, E). Then n i=1 d(v i) = 2 E. Observation If d G (v) 2 v V (G) then G contains cycles. Corolary (6-2) A tree has vertices of degree 1. Such vertices are called leaves. If G is a connected graph and d G (v i ) = 1 then G \ {v i } remains connected. If C k is a cycle in G and e E(G) C k then G \ {e} remains connected.

Mathematical representation of graphs Two structures are commonly used to represent graphs: Adjacency Matrix (smetimes called incidence matrix)

Mathematical representation of graphs Two structures are commonly used to represent graphs: Adjacency Matrix (smetimes called incidence matrix) Adjacency list

Mathematical representation of graphs Two structures are commonly used to represent graphs: Adjacency Matrix (smetimes called incidence matrix) Adjacency list (The adjacency matrix) Let G(V, E) be a labeled graph of order n. The adjacency matrix of G denoted by A(G) is the n n matrix defined by: { 0 if i = j or (i, j) E(G) A i,j = 1 if (i, j) E(G)

Mathematical representation of graphs Two structures are commonly used to represent graphs: Adjacency Matrix (smetimes called incidence matrix) Adjacency list (The adjacency matrix) Let G(V, E) be a labeled graph of order n. The adjacency matrix of G denoted by A(G) is the n n matrix defined by: { 0 if i = j or (i, j) E(G) A i,j = 1 if (i, j) E(G) Comment This representation can also be used for digraphs or weighted graphs. For a simple graph, the matrix is symmetric. In weighted graphs 1 s will be replaced by the weight of the edge (i, j).

Adcacency matrix representation of a digraph 0: 0 0 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 1 1: 0 0 1 1 0 0 1 0 0 0 1 0 1 0 1 1 0 1 0 0 2: 1 1 0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 0 1 3: 1 1 0 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1 0 1 4: 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 5: 1 0 1 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 6: 0 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 1 7: 1 0 0 1 0 1 1 0 1 1 0 0 1 0 0 0 0 0 0 0 8: 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 9: 1 0 1 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 10: 0 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 11: 1 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 1 1 1 0 12: 0 1 1 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 13: 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 14: 0 1 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 0 1 1 1 1 0 1 0 1 1 0 0 0 18: 0 0 0 0 1 0 1 0 0 1 1 1 0 1 1 0 1 0 0 0 19: 0 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 0 A digraph of order 20

Adcacency matrix representation of a graph 0: 0 80 0 0 0 0 0 70 0 47 78 95 0 0 0 0 0 0 34 0 94 24 1: 80 0 28 69 96 22 31 0 78 52 0 0 0 0 0 0 73 0 96 43 70 75 2: 0 28 0 46 58 0 0 0 57 0 0 91 0 13 26 0 0 89 61 0 0 0 3: 0 69 46 0 0 0 0 0 0 33 0 0 0 98 0 0 0 71 0 67 88 98 4: 0 96 58 0 0 0 11 12 0 69 0 0 80 82 0 0 86 0 0 0 0 99 5: 0 22 0 0 0 0 0 0 0 22 0 79 0 0 0 0 0 50 0 36 57 0 6: 0 31 0 0 11 0 0 0 0 98 0 0 17 0 0 50 0 74 0 11 97 0 7: 70 0 0 0 12 0 0 0 0 31 0 0 50 0 43 20 91 0 31 0 0 0 8: 0 78 57 0 0 0 0 0 0 0 0 51 0 63 70 10 86 0 0 0 0 10 9: 47 52 0 33 69 22 98 31 0 0 68 79 0 0 0 91 0 0 40 53 0 0 10: 78 0 0 0 0 0 0 0 0 68 0 0 0 0 56 0 78 0 0 0 0 36 11: 95 0 91 0 0 79 0 0 51 79 0 0 67 0 0 0 77 0 52 88 11 0 12: 0 0 0 0 80 0 17 50 0 0 0 67 0 0 0 97 0 47 0 0 0 0 13: 0 0 13 98 82 0 0 0 63 0 0 0 0 0 0 73 0 0 0 76 94 0 14: 0 0 26 0 0 0 0 43 70 0 56 0 0 0 0 0 77 18 23 0 0 0 15: 0 0 0 0 0 0 50 20 10 91 0 0 97 73 0 0 0 0 0 37 0 0 16: 0 73 0 0 86 0 0 91 86 0 78 77 0 0 77 0 0 0 0 0 0 21 17: 0 0 89 71 0 50 74 0 0 0 0 0 47 0 18 0 0 0 0 0 0 0 18: 34 96 61 0 0 0 0 31 0 40 0 52 0 0 23 0 0 0 0 0 0 0 19: 0 43 0 67 0 36 11 0 0 53 0 88 0 76 0 37 0 0 0 0 0 0 20: 94 70 0 88 0 57 97 0 0 0 0 11 0 94 0 0 0 0 0 0 0 0 21: 24 75 0 98 99 0 0 0 10 0 36 0 0 0 0 0 21 0 0 0 0 0 A weighted graph of order 22

The adjacency list. As the name suggests, it is a list of neighbors of every vertex. The following example should make it clear: 0: 7, 3, 15 1: 2, 13, 14 2: 1, 10, 13 3: 7, 0, 15 4: 8, 9, 12, 14 5: 8, 9, 11, 13 6: 8, 10, 11, 13 7: 0, 3, 11, 8 8: 4, 5, 6, 7 9: 4, 5, 10 10: 2, 6, 9 11: 5, 6, 7, 12 12: 4, 11 13: 1, 2, 5, 6 14: 1, 4, 15 15: 14, 4, 3 A labeled graph of order 16

Graph Traversals Question

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G?

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected?

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected? Does it have a cut-vertex?

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected? Does it have a cut-vertex? These are some common questions in many applications.

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected? Does it have a cut-vertex? These are some common questions in many applications. Answer Graph traversals are tools that will help us answer these and many other questions. There are two fundamental graph traversals:

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected? Does it have a cut-vertex? These are some common questions in many applications. Answer Graph traversals are tools that will help us answer these and many other questions. There are two fundamental graph traversals: BFS breadth-first-search.

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected? Does it have a cut-vertex? These are some common questions in many applications. Answer Graph traversals are tools that will help us answer these and many other questions. There are two fundamental graph traversals: BFS breadth-first-search. DFS depth-first-search.

Graph Traversals Question What is the distance from vertex i to vertex j in a graph G? Is the graph connected? Does it have a cut-vertex? These are some common questions in many applications. Answer Graph traversals are tools that will help us answer these and many other questions. There are two fundamental graph traversals: BFS breadth-first-search. DFS depth-first-search. Both turn out to be useful in many applications.

BFS BFS of a connected graph G starts with a vertex v V (G) and produces a spanning tree T such that a shortest path from v w in G is the path from v w in T. (BFS Algorithm)

BFS BFS of a connected graph G starts with a vertex v V (G) and produces a spanning tree T such that a shortest path from v w in G is the path from v w in T. (BFS Algorithm) Start with an empty tree T.

BFS BFS of a connected graph G starts with a vertex v V (G) and produces a spanning tree T such that a shortest path from v w in G is the path from v w in T. (BFS Algorithm) Start with an empty tree T. Add v to T.

BFS BFS of a connected graph G starts with a vertex v V (G) and produces a spanning tree T such that a shortest path from v w in G is the path from v w in T. (BFS Algorithm) Start with an empty tree T. Add v to T. Scan and add all vertices v 1,..., v dg (v) that are connected by an edge in G to v and all these edges. Delete v from G.

BFS BFS of a connected graph G starts with a vertex v V (G) and produces a spanning tree T such that a shortest path from v w in G is the path from v w in T. (BFS Algorithm) Start with an empty tree T. Add v to T. Scan and add all vertices v 1,..., v dg (v) that are connected by an edge in G to v and all these edges. Delete v from G. For each vertex v i of T add all neighbors of v i that are not yet in T and the edges connecting them to v i and remove v i from G.

BFS BFS of a connected graph G starts with a vertex v V (G) and produces a spanning tree T such that a shortest path from v w in G is the path from v w in T. (BFS Algorithm) Start with an empty tree T. Add v to T. Scan and add all vertices v 1,..., v dg (v) that are connected by an edge in G to v and all these edges. Delete v from G. For each vertex v i of T add all neighbors of v i that are not yet in T and the edges connecting them to v i and remove v i from G. Stop when G is empty.

Example Comment BFS can be used to detect whether G is connected. It can also be applied to Digraphs.

Example Comment BFS can be used to detect whether G is connected. It can also be applied to Digraphs. Recall: a knight s move on a chess board is one square in one direction (horizontal or vertical) followed by two squares in the perpendicular direction. In the following 8 8 chessboard some of the squares are white and some are black. Two squares are marked by S and F Your goal is to find the smallest number of knight moves starting at S and ending at F. A knight is not allowed to use a black box.

Example Comment BFS can be used to detect whether G is connected. It can also be applied to Digraphs. Recall: a knight s move on a chess board is one square in one direction (horizontal or vertical) followed by two squares in the perpendicular direction. In the following 8 8 chessboard some of the squares are white and some are black. Two squares are marked by S and F Your goal is to find the smallest number of knight moves starting at S and ending at F. A knight is not allowed to use a black box. Question How would you solve this puzzle?

Example: knigths move on a chessboard. Remark The graph will be built conceptually. We can actually build the BFS tree on the chessboard.

Example: knigths move on a chessboard. Remark The graph will be built conceptually. We can actually build the BFS tree on the chessboard. A B C D E F G H 1 S 2 3 4 5 F 6 7 8 Bảng: The knights shortest path