Graph Theory An Introduction.

Slides:



Advertisements
Similar presentations
Chapter 8 Topics in Graph Theory
Advertisements

Chapter 9 Graphs.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Review Binary Search Trees Operations on Binary Search Tree
Introduction to Graphs
13 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Section 2.1 Euler Cycles Vocabulary CYCLE – a sequence of consecutively linked edges (x 1,x2),(x2,x3),…,(x n-1,x n ) whose starting vertex is the ending.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Introduction to Graphs
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Applied Discrete Mathematics Week 12: Trees
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Graphs, relations and matrices
GRAPH Learning Outcomes Students should be able to:
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
Graph Theory Topics to be covered:
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Fall 2005Costas Busch - RPI1 Mathematical Preliminaries.
Prof. Busch - LSU1 Mathematical Preliminaries. Prof. Busch - LSU2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Graphs.  Definition A simple graph G= (V, E) consists of vertices, V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Data Structures & Algorithms Graphs
Introduction to Graphs. This Lecture In this part we will study some basic graph theory. Graph is a useful concept to model many problems in computer.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
1 Mathematical Preliminaries. 2 Sets Functions Relations Graphs Proof Techniques.
Chapter 9: Graphs.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
COMPSCI 102 Introduction to Discrete Mathematics.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Week 10 - Wednesday.  What did we talk about last time?  Counting practice  Pigeonhole principle.
Fundamental Graph Theory (Lecture 1) Lectured by Hung-Lin Fu 傅 恆 霖 Department of Applied Mathematics National Chiao Tung University.
Trees.
Graphs. Representations of graphs : undirected graph An undirected graph G have five vertices and seven edges An adjacency-list representation of G The.
An Introduction to Graph Theory
Graphs: Definitions and Basic Properties
Let us switch to a new topic:
Applied Discrete Mathematics Week 13: Graphs
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
CSE 373, Copyright S. Tanimoto, 2001 Graphs 1 -
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Chapter 5 Fundamental Concept
Euler Paths and Circuits
Graph theory Definitions Trees, cycles, directed graphs.
Agenda Lecture Content: Introduction to Graph Path and Cycle
Konigsberg’s Seven Bridges
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Advanced Algorithms Analysis and Design
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Graphs.
Planarity Testing.
Graphs Chapter 13.
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Mathematical Preliminaries
Representing Graphs Wade Trappe.
Theorem 5.13: For vT‘, l’(v)= min{l(v), l(vk)+w(vk, v)}
Let us switch to a new topic:
Discrete Mathematics for Computer Science
Introduction to Graph Theory
Applied Discrete Mathematics Week 13: Graphs
Agenda Review Lecture Content: Shortest Path Algorithm
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

Graph Theory An Introduction

Seven Bridges of Königsberg Leonhard Euler in 1736 laid the foundations of graph theory. The city of Königsberg in Prussia (now Kaliningrad, Russia) was set on both sides of the Pregel River, and included two large islands which were connected to each other and the mainland by seven bridges. He wished to devise a walk through the city that would cross each bridge once and only once.

Sex in America On average, who has more opposite-gender partners, men or women? The University of Chicago interviewed a “random sample” of 2500 people over several years to try to get an answer to this question. Their study, published in 1994, and entitled The Social Organization of Sexuality found that on average men have 74% more opposite gender partners than women. ABC News “Primetime Live” found through a survey in 2004 that the average man has 20 partners, and women 6, over their lifetimes, with a claimed 2.5% margin of error. (That’s 233%) What do you think about this? (mathematically)

Introduction Informally, a graph is a bunch of dots connected by lines

Formal graphs Formally, a graph is a pair of sets (V, E), where: V is a nonempty set whose elements are called vertices. E is a collection of two­ element subsets of V called edges. The vertices correspond to the circles in the picture, and the edges correspond to the lines. Thus, the dots­ and­ lines diagram above is a pictorial representation of the graph (V, E) where: V = {A, B, C, D, E, F, G, H, I} E = {{A, B} , {A, C} , {B, D} , {C, D} , {C, E} , {E, F} , {E, G} , {H, I}} .

Example Graph reprsentation The above graph is (V, E) where: V = {A, B, C, D, E, F, G, H, I} E = {{A, B} , {A, C} , {B, D} , {C, D} , {C, E} , {E, F} , {E, G} , {H, I}} .

Graph Definitions Graphs – networks Vertices – nodes Edges – arcs Two vertices in a graph are said to be adjacent if they are joined by an edge, and an edge is said to be incident to the vertices it joins. The number of edges incident to a vertex is called the degree of the vertex. Deleting some vertices or edges from a graph leaves a subgraph. Formally, a subgraph of G = (V, E) is a graph G’ = (V ‘ , E’ ) where V ‘ is a nonempty subset of V and E’ is a subset of E.

Graph terms Find nodes that are adjacent. What node are incident of C? What is the degree of A, of F, of G? Define a valid proper subgraph of the graph above.

Graph variations In a multigraph, there may be more than one edge between a pair of vertices.

Graph variations In a directed graph are arrows pointing to one endpoint or the other.

Common Graphs Complete Graph K6 Empty Graph Path with 5 vertices Cycle with 5 vertices

Sex in America Men have 74% more opposite gender partners than women? Let G = (V, E) be a graph where the set of vertices V consists of everyone in America. Let us partition V into M⊂V (men) and W⊂V (women): What do the edges represent?

Sorry guys!! Sex in America In US |V| = 300 million, |M| = 147.6 million, |W| = 152.4.million. A LOT of possible edges! Let Am be average number of male OGPs*, and Aw is average female OGPs Does Am/Aw =1.74? Sorry guys!! So men are having 3% more OGP then women, on average *OGP – Opposite Gender Partnerships.

Paths A path is a graph P = (V, E) of the form V = {v1, v2, . . . , vn} E = {(v1 ,v2), (v2 ,v3), . . . ,(vn−1 ,vn)} Similarly, a cycle is a graph C = (V, E) of the form: C = (V, E) of the form E = {(v1 ,v2), (v2 ,v3), . . . ,(vn−1 ,vn), ( vn, v1) }

Connectivity A graph is connected if for every pair of vertices u and v, the graph contains a path with endpoints u and v as a subgraph. Not Connected Connected two Connected components one Connected components

A Simple Connectivity Theorem Theorem. Every graph G = (V, E) has at least |V | − |E| connected components. Can you prove it?

A Simple Connectivity Theorem Theorem. Every graph G = (V, E) has at least |V | − |E| connected components. Proof. We use induction on the number of edges. Let P(n) be the proposition that every graph G = (V, E) with |E| = n has at least | | V − n connected components. Base case: In a graph with 0 edges, each vertex is itself a connected component, and so there are exactly |V | − 0 = | | V connected components.

A Simple Connectivity Theorem Inductive step: Now we assume that the induction hypothesis holds for every n­-edge graph in order to prove that it holds for every (n + 1)-­edge graph, where n ≥ 0. Consider a graph G = (V, E) with n + 1 edges. Remove an arbitrary edge u—v and call the resulting graph G’’ . By the induction assumption, G’’ has at least |V | − n connected components. Now add back the edge u—v to obtain the original graph G. If u and v were in the same connected component of G’’ , then G has the same number of connected components as G’ , which is at least |V | − n. Otherwise, if u and v were in different connected components of G’ , then these two components are merged into one in G, but all other components remain. Therefore, G has at least |V| − n − 1 = | V | − (n + 1) connected components.

Distance and Diameter The distance between two vertices in a graph is the length of the shortest path between them. The diameter of a graph is the distance between the two vertices that are farthest apart.

Traversing a Graph Can you walk every hallway in the Ascension Hall exactly once? If we represent hallways and intersections with edges and vertices, then this reduces to a question about graphs.

Euler Tours and Hamiltonian Cycles A walk in a graph G is an alternating sequence of vertices and edges of the form: v0, v —v1, v1, v1—v2, v2, . . . , vn−1, vn−1—vn, vn If v0 = vn, then the walk is closed. Walks are similar to paths. However, a walk can cross itself, traverse the same edge multiple times, etc. There is a walk between two vertices if and only if there is a path between the vertices. The entire field of graph theory began when Euler asked whether the seven bridges of Königsberg could all be traversed exactly once.

Euler Tours and Hamiltonian Cycles An Euler walk is a walk that contains every edge in a graph exactly once. Similarly, an Euler tour is an Euler walk that starts and finishes at the same vertex; that is, v0 = vn.

Euler tour Theorem. A connected graph has an Euler tour if and only if every vertex has even degree. Corollary. A connected graph has an Euler walk if and only if either 0 or 2 vertices have odd degree.

Hamiltonian cycles A Hamiltonian cycle is walk that starts and ends at the same vertex and visits every vertex in a graph exactly once. Determining whether a given graph has a Hamiltonian cycle is “NP­ complete”.

Adjacency Matrices A graph can be represented by an adjacency matrix. If a graph has vertices v1, . . . , vn, then the adjacency matrix is n × n. The entry in row i, column j is 1 if there is an edge vi —vj and is 0 if there is no such edge. Why is the matrix symmetric? What about a directed graph? What would it mean to have non-zero entries o n the diagonal?

Trees A vertex of degree one is called a leaf A connected, acyclic graph is called a tree. A vertex of degree one is called a leaf Can we add or remove an edge and still have a tree?

Trees Theorem. Every tree T = (V, E) has the following properties: There is a unique path between every pair of vertices. Adding any edge creates a cycle. Removing any edge disconnects the graph. Every tree with at least two vertices has at least two leaves. |V| =| E| + 1.

Spanning Trees Every connected graph G = (V, E) contains a spanning tree T = (V, E’ ) as a subgraph

Binary Tree A binary tree is a rooted tree in which every vertex has at most two children.

Ordered, binary tree In an ordered, binary tree, the children of a vertex v are distinguished. One is called the left child of v, and the other is called the right child. For example, if we regard the two binary trees below as unordered, then they are equivalent. However, if we regard these trees as ordered, then they are different.

Problems Prove that the sum of the degrees of the vertices of any finite graph is even. Show that every simple graph has two vertices of the same degree. Show that if n people attend a party and some shake hands with others (but not with themselves), then at the end, there are at least two people who have shaken hands with the same number of people. Prove that a complete graph with n vertices contains n(n − 1)/2 edges.

Even degrees Prove that the sum of the degrees of the vertices of any finite graph is even. Proof: Each edge ends at two vertices. If we begin with just the vertices and no edges, every vertex has degree zero, so the sum of those degrees is zero, an even number. Now add edges one at a time, each of which connects one vertex to another, or connects a vertex to itself (if you allow that). Either the degree of two vertices is increased by one (for a total of two) or one vertex’s degree is increased by two. In either case, the sum of the degrees is increased by two, so the sum remains even.

Two vertices of the same degree Show that every simple graph has two vertices of the same degree. Proof: This can be shown using the pigeon hole principle. Assume that the graph has n vertices. Each of those vertices is connected to either 0, 1, 2, . . . , n − 1 other vertices. If any of the vertices is connected to n − 1 vertices, then it is connected to all the others, so there cannot be a vertex connected to 0 others. Thus it is impossible to have a graph with n vertices where one is vertex has degree 0 and another has degree n − 1. Thus the vertices can have at most n − 1 different degrees, but since there are n vertices, at least two must have the same degree.

Hand Shaking Show that if n people attend a party and some shake hands with others (but not with themselves), then at the end, there are at least tw Proof: See previous problem. Each person is a vertex, and a handshake with another person is an edge to that person. o people who have shaken hands with the same number of people.

Complete Graph Prove that a complete graph with n vertices contains n(n − 1)/2 edges. Proof: This is easy to prove by induction. If n = 1, zero edges are required, and 1(1 − 0)/2 = 0. Assume that a complete graph with k vertices has k(k − 1)/2. When we add the (k + 1)st vertex, we need to connect it to the k original vertices, requiring k additional edges. We will then have k(k − 1)/2 + k = (k + 1)((k + 1) − 1)/2 vertices, and we are done.