Artificial Intelligence

Similar documents
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.

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

Basics of Graph Theory

Elements of Graph Theory

An Introduction to Graph Theory

Combinatorics Summary Sheet for Exam 1 Material 2019

v V Question: How many edges are there in a graph with 10 vertices each of degree 6?

WUCT121. Discrete Mathematics. Graphs

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

Discrete mathematics II. - Graphs

Lecture 1: Examples, connectedness, paths and cycles

Math 776 Graph Theory Lecture Note 1 Basic concepts

Chapter 11: Graphs and Trees. March 23, 2008

Majority and Friendship Paradoxes

CPCS Discrete Structures 1

Artificial Intelligence

Fundamental Properties of Graphs

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

Discrete mathematics

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

An Introduction to Graph Theory

The Konigsberg Bridge Problem

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.

Lecture 6: Graph Properties

MATH 350 GRAPH THEORY & COMBINATORICS. Contents

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

Assignment 1 Introduction to Graph Theory CO342

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

Theorem 2.9: nearest addition algorithm

Part II. Graph Theory. Year

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

Assignment 4 Solutions of graph problems

ECS 20 Lecture 17b = Discussion D8 Fall Nov 2013 Phil Rogaway

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

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

4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar.

Discrete mathematics

Lecture 8: The Traveling Salesman Problem

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Introduction III. Graphs. Motivations I. Introduction IV

List of Theorems. Mat 416, Introduction to Graph Theory. Theorem 1 The numbers R(p, q) exist and for p, q 2,

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

Number Theory and Graph Theory

Introduction to Graph Theory

1 Digraphs. Definition 1

Introduction to Graphs

Solutions to Exercises 9

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

Graph Theory. Part of Texas Counties.

Chapter 2 Graphs. 2.1 Definition of Graphs

Matching Theory. Figure 1: Is this graph bipartite?

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.

The University of Sydney MATH2969/2069. Graph Theory Tutorial 2 (Week 9) 2008

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Discrete Wiskunde II. Lecture 6: Planar Graphs

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

11.4 Bipartite Multigraphs

Varying Applications (examples)

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

(5.2) 151 Math Exercises. Graph Terminology and Special Types of Graphs. Malek Zein AL-Abidin

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

Assignments are handed in on Tuesdays in even weeks. Deadlines are:

Graphs. Introduction To Graphs: Exercises. Definitions:

IMO Training 2008: Graph Theory

11.9 Connectivity Connected Components. mcs 2015/5/18 1:43 page 419 #427

Lecture 19. Broadcast routing

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Bipartite Roots of Graphs

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 20 : Trees DRAFT

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Radhika Nagpal.

8.2 Paths and Cycles

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

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

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

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Week 11: Minimum Spanning trees

How many colors are needed to color a map?

Number Theory and Graph Theory

Introduction to Graph Theory

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

GRAPH THEORY: AN INTRODUCTION

Greedy algorithms is another useful way for solving optimization problems.

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

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

HW Graph Theory SOLUTIONS (hbovik) - Q

Lecture outline. Graph coloring Examples Applications Algorithms

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

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Graph Theory

Math 170- Graph Theory Notes

Lecture 22 Tuesday, April 10

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

How can we lay cable at minimum cost to make every telephone reachable from every other? What is the fastest route between two given cities?

CS 561, Lecture 9. Jared Saia University of New Mexico

Transcription:

Artificial Intelligence Graph theory G. Guérard Department of Nouvelles Energies Ecole Supérieur d Ingénieurs Léonard de Vinci Lecture 1 GG A.I. 1/37

Outline 1 Graph theory Undirected and directed graphs Degree 2 Basics properties Path and Cycles Specifications 3 Classic problems Eulerian circuit Hamiltonian circuit Spanning tree Graph Coloring GG A.I. 2/37

Introduction A graph is a mathematical object consisting of a set of: NODES - V EDGES - E GRAPH is denoted by G = (V, E ) n = V and m = E A graph captures pairwise relationship between objects. GG A.I. 3/37

Undirected graph Undirected graph An UNDIRECTED GRAPH is a pair: G = (V, E ) where V is a nonempty SET OF VERTICES and E = {(u, v) : u, v V } is a SET OF EDGES. Remark Let m = (p, q) E. This means that the edge m connects the vertex p and the vertex q. Moreover, in such a case p and q are called the ENDPOINTS of m and we say that p and q are incident with m, they are ADJACENT or neighbours of each other. GG A.I. 4/37

Example Undirected graph Consider the undirected graph G = (V, E ) where V = {a, b, c, d, e}, and E = {(a, b), (a, c), (a, e), (e, b), (d, b), (c, d), (d, e)}. Remark We usually use a graphical representation of the graph. The vertices are represented by points and the edges by lines connecting the points. GG A.I. 5/37

Example Bipartite Consider a set of discipline D = {A, B, C, D} and students S = {1, 2, 3, 4}. Every student is interested in some schools D i D. The situation can be easily modelled by the graph G = (D S, E ). GG A.I. 6/37

Special edges Multiedges MULTIEDGES are edges which connect the same pair of vertices and a LOOP connects the vertex with itself. A graph with multiedges and loops is called a MULTIGRAPH. GG A.I. 7/37

Special edges We can associated WEIGHTS to edges (see previous example). These weights can represent cast, profit, length, capacity, action, etc. of a given connection. Weight The weight is a mapping from the set of edges to a set of numbers or alphabet w : E R or Σ. The graph with weight function of numbers is called a NETWORK and denoted by G = (V, E, w). Alphabet or probability give two others types of graphs: automata and markov chain. GG A.I. 8/37

Example Weight Let us consider the graph G = (V, E, w) seen previously, and the weight function: e E (a, b) (a, c) (a, e) (d, b) (e, b) (d, e) (d, c) w(e) -9 3 6 0 12 8 0.7 GG A.I. 9/37

Directed graph Directed graph A DIRECTED GRAPH is a pair G = (V, E ) where V is a nonempty set of vertices and E = {(u, v) : u, v V } is a set of directed edges (or ARCS). If (p, q) E, p is the head of the arc and q is the tail of the arc. GG A.I. 10/37

Example Directed graph Consider the directed graph G = (V, E ) where V = {a, b, c, d, e}, and E = {(a, b), (a, c), (a, e), (e, b), (d, b), (c, d), (d, e)}. GG A.I. 11/37

Degree Undirected graph The DEGREE of the vertex v is the number of edges incident to the vertex, with loops counted twice. The degree of a vertex is denoted deg(v) or Γ(v). A vertex v with degree 0 is called an ISOLATED. A vertex with degree 1 is called an endvertex or a LEAF. The degree of the graph G, (G ) is the maximum degree of its vertices. (G ) = max Γ(V ). v V GG A.I. 12/37

Example Degree Consider the graph Isolated vertices are x 5 and x 7. Leaves are x 4 and x 6. (G ) = max v V Γ(V ) = deg(x 2) = 5. GG A.I. 13/37

Degree Directed graph The IN-DEGREE of a vertex v, Γ (v), is the number of head endpoints adjacent to v. The OUT-DEGREE of a vertex v, Γ + (v), is the number of head endpoints adjacent to v. The degree of a vertex is Γ(v) = Γ (v) + Γ + (v). A vertex s for which Γ (v) = 0 and Γ + (v) > 0 is called a SOURCE and a vertex t for which Γ (v) > 0 and Γ + (v) = 0 is called a SINK. GG A.I. 14/37

Example Degree Consider the directed graph Γ (x) = 3, Γ + (x) = 2; Γ (y) = 5, Γ + (y) = 1. (G ) = max Γ(V ) = deg(y) = 6. There is no source or sink v V (technically, y can be called a sink because we can t escape from y to another vertex). GG A.I. 15/37

Example Source and sink Consider the directed graph Sources are vertices a and c, sink is the vertex e. GG A.I. 16/37

Degree Theorem For any graph, we have v V deg(v) = 2 E. The demonstration is trivial, any edge connects two vertices. So an edge (directed or undirected) increase the total of degrees by two. Theorem The number of vertices of odd degree is even. The sum of all the degrees is equal to twice the number of edges. Since the sum of the degrees is even and the sum of the degrees of vertices with even degree is even, the sum of the degrees of vertices with odd degree must be even. If the sum of the degrees of vertices with odd degree is even, there must be an even number of those vertices. GG A.I. 17/37

Definition Path A PATH (or CHAIN in a directed graph) in a graph is a sequence of edges (or arcs) which connect a sequence of vertices. To be more specific, a sequence (e 1,..., e n ) is called a path of the LENGTH n if there are vertices v 0,..., v n such that e i = (v i 1, v i ), i = 1..n. The first vertex v 1 is called START vertex, and the last vertex v n is called END vertex. Both of them are called TERMINAL vertices of the path. If v 0 = v n then the sequence is called a closed path. A closed path which the edges and vertices are distinct (exept terminals) is called a CYCLE (or a CIRCUIT in directed graph). GG A.I. 18/37

Example Path Consider the graph (d, e, g, b, a) is a closed path. (d, g, b, a) is a cycle. GG A.I. 19/37

Definition Acyclic A graph without cycles is called ACYCLIC. Connected A graph is called CONNECTED if for any couple of vertices u and v there exists a path connecting u and v, i.e. with start vertex is u and end vertex is v. GG A.I. 20/37

Tree Tree A connected and acyclic graph is called a TREE. a, b, c, d are trees, e has a cycle. GG A.I. 21/37

Complete graph Complete graph A COMPLETE graph K n is the graph with n vertices and all the pairs of vertices are adjacent to each other. Theorem In any K n, deg(v) = n 1, v V. The number of edges is E = [ i= 1]n i = n(n 1) 2. GG A.I. 22/37

Subgraph Subgraph A graph H = (V H, E H ) is called a SUBGRAPH of G = (V, E ) when V H V and E H E. Consider graphs G 1 and G 2 are subgraphs of G. GG A.I. 23/37

Eulerian circuit Problem GIVEN THE GRAPH, IS IT POSSIBLE TO CONSTRUCT A PATH (OR A CYCLE) WHICH VISITS EACH EDGE EXACTLY ONCE? Eulerian circuit How can we recognize Eulerian graph? They have two characterizations: node degrees, existence of a special collection of cycles. Theorem For a connected graph G, the following statements are equivalent: G is Eulerian (1); Every vertex of G has even degree (2); The edges of G can be partitioned into edge-disjoint cycles (3). GG A.I. 24/37

Eulerian circuit Proof 1 > 2 Assume G is Eulerian there exists a circuit that includes every edge of G. Every time a circuit enters a node v on an edge, it leave on a different edge. Since the circuit never repeats an edge, the number of edges incident with v is even deg(v) is even. GG A.I. 25/37

Eulerian circuit Proof 2>3 Suppose every node of G has even degree. We use induction on the number of cycles in G. G is connected and without nodes of degree 1, so G is not a tree, Ghas at least one cycle C n1. Let G be the graph obtained by removing C n1 from G. All edges of G have even degree and we can proceed recursively to prove that G can be partitioned into cycles C n2... C nk. Then, C n1... C nk is a partition of G into edge-disjoint cycles. GG A.I. 26/37

Eulerian circuit Proof 3>1 Suppose that the edges of G can be partitioned into k edge-disjoint cycles C n1... C nk. Because G is connected, every such cycle is an Eulerian circuit which must share a node with another cycle these circuits can be patched until we obtain one Eulerian circuit which is the whole graph G. GG A.I. 27/37

Eulerian path Question How to recognize graph which contain an Eulerian path? Note that: If the graph is Eulerian, then it contains an Eulerian path because every Eulerian circuit is also a path. Corollary A connected graph G contains an Eulerian path iff there are at most two vertices of odd degree. GG A.I. 28/37

Hamiltonian circuit Problem GIVEN THE GRAPH, IS IT POSSIBLE TO CONSTRUCT A PATH (OR A CYCLE) WHICH VISITS EACH VERTEX EXACTLY ONCE? Hamiltonian circuit How can we recognize Eulerian graph? There is no simple characterisation for this problem. Hamiltonian graphs can have all even degrees, all odd degrees, or a mixture. GG A.I. 29/37

Hamiltonian circuit Dirac s Theorem Let G be a graph of order n 3. If deg(g ) n 2, then G is Hamiltonian. Dirac s Theorem 2 Let G be a graph of order n 3. If deg(x) + deg(y) n for all pairs of nonadjacent nodes x, y, then G is Hamiltonian. GG A.I. 30/37

Definition Spanning tree A SPANNING TREE T of an undirected graph G is a subgraph that is a tree which includes all of the vertices of G. A MINIMUM SPANNING TREE (MST) connects all the vertices together with the minimal total weighting for its edges (see KRUSKAL and PRIM). Applications In order to minimize the cost of power networks, wiring connections, piping, automatic speech recognition, etc., we use algorithms that gradually build a spanning tree (or many such trees) as intermediate steps in the process of finding the minimum spanning tree. The Internet and many other telecommunications networks have transmission links that connect nodes together in a mesh topology that includes some loops. In order to avoid bridge loops and routing loops, many routing protocols designed for such networks require each router to remember a spanning tree. GG A.I. 31/37

Kruskal s Algorithm KRUSKAL S ALGORITHM is a greedy algorithm for the MST problem. Initially, let T be the empty graph on V. Examine the edges in E in increasing order of weight: If an edge connects two unconnected components of T, then add the edge to T Else, discard the edge and continue. Terminate when there is only one connected component. GG A.I. 32/37

Prim s Algorithm PRIM S ALGORITHM is a greedy algorithm for the MST problem. Initialize a tree with a single vertex, chosen arbitrarily from the graph. Grow the tree by one edge: of the edges that connect the tree to vertices not yet in the tree, find the minimum-weight edge, and transfer it to the tree. Repeat step 2 (until all vertices are in the tree). GG A.I. 33/37

Definition Definition GRAPH COLORING is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color; this is called a VERTEX COLORING. Similarly, an EDGE COLORING assigns a color to each edge so that no two adjacent edges share the same color, and a face coloring of a planar graph assigns a color to each face or region so that no two faces that share a boundary have the same color. Without any qualification, a coloring is always a vertex coloring. GG A.I. 34/37

Definition Definition Given a graph G (V, E ) with vertex set V and edge set E, a k-colouring of G is a function C : V {1... k} that assigns distinct values to adjacent vertices. For each edge e = (u, v) E, we require C (u) = C (v). If G has a k-colouring then it is said to be k-colourable. In words, a graph is k-colourable if one can draw it in such a way that no two adjacent vertices have the same colour. The chromatic number χ(g ) is the smallest number k such that G is k-colourable. GG A.I. 35/37

Applications The problem of coloring a graph arises in many practical areas such as pattern matching, sports scheduling, designing seating plans, exam timetabling, the scheduling of taxis, and solving Sudoku puzzles. Example A given set of jobs need to be assigned to time slots, each job requires one such slot. Jobs can be scheduled in any order, but pairs of jobs may be in conflict in the sense that they may not be assigned to the same time slot, for example because they both rely on a shared resource. The corresponding graph contains a vertex for every job and an edge for every conflicting pair of jobs. The chromatic number of the graph is exactly the minimum makespan, the optimal time to finish all jobs without conflicts. GG A.I. 36/37

Fundamental knowledge YOU HAVE TO KNOW BEFORE THE TUTORIAL: 1 Caracteristics and differences between undirected and directed graphs; 2 Notion of degrees, how to calculate them; 3 Notion of path and cycles; 4 Hamiltonian and eulerian definitions (Problem block); 5 Kruskal and Prim s algorithms; 6 Graph coloration. GG A.I. 37/37