Graphs Discrete Structure CS203.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

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.
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Introduction to Graphs
Applied Discrete Mathematics Week 12: Trees
SE561 Math Foundations Week 11 Graphs I
Graph Theory in CS Route Search in Online Map Services
Math Foundations Week 12 Graphs (2). Agenda Paths Connectivity Euler paths Hamilton paths 2.
Selected Topics in Data Networking Graph Representation.
Graphs.
Graphs and Trees This handout: Terminology of Graphs Applications of Graphs.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Let us switch to a new topic:
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
GRAPH Learning Outcomes Students should be able to:
Graph Theory Chapter 6 from Johnsonbaugh Article(6.1, 6.2)
Introduction to Network Theory: Basic Concepts
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,
Lecture 5.2: Special Graphs and Matrix Representation CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
Can you connect the dots as shown without taking your pen off the page or drawing the same line twice.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
Copyright © Zeph Grunschlag, More on Graphs.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Based on slides by Y. Peng University of Maryland
GRAPHS THEROY. 2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism.
Basic Notions on Graphs. The House-and-Utilities Problem.
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
CSS106 Introduction to Elementary Algorithms
Introduction to Graph Theory
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
And before you really hate (mathematical) relations and begin to break your (social) relations, let’s switch to a new topic: Graphs Discrete Structures.
Graph Theory Unit: 4.
Chapter 9: Graphs.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Graph Theory Graph Theory - History Leonhard Euler's paper on “Seven Bridges of Königsberg”, published in 1736.
Lecture 5.3: Graph Isomorphism and Connectivity CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
An Introduction to Graph Theory
Applied Discrete Mathematics Week 14: Trees
EECS 203 Lecture 19 Graphs.
CSNB 143 Discrete Mathematical Structures
Chapter 9 (Part 2): Graphs
Let us switch to a new topic:
Lecture 5.2: Special Graphs and Matrix Representation
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Copyright © Zeph Grunschlag,
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
CSE 373, Copyright S. Tanimoto, 2001 Graphs 1 -
CS 250, Discrete Structures, Fall 2015
Agenda Lecture Content: Introduction to Graph Path and Cycle
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Graphs.
Graphs.
Based on slides by Y. Peng University of Maryland
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Graph Theory.
Graphs Chapter 13.
CSE 373, Copyright S. Tanimoto, 2002 Graphs 1 -
CS100: Discrete structures
Decision Maths Graphs.
Lecture 5.3: Graph Isomorphism and Paths
Introduction to Graph Theory
Applied Discrete Mathematics Week 13: Graphs
Based on slides by Y. Peng University of Maryland
Presentation transcript:

Graphs Discrete Structure CS203

Uses of Graph in CS Car navigation system Efficient database A graph is a set of vertices (or nodes) represented by circles which are connected by edges, represented by line segments . Car navigation system Efficient database computer network Representing computational models

Transportation networks Graph terminology often derived from transportation metaphors E.g. “shortest path“, “flow“, “diameter“

A structural network The physics of rigidity theory is applied at every network node to design stable structures

An electrical network The physics of Kirchoff‘s laws is applied at every network node and closed paths to design circuits

Introduction to graph theory Begun in 1735 Bridges of Konigsberg (today’s Kaliningrad): walk all 7 bridges without crossing a bridge twice 6 1 2 5 3 4 7 Solved by: parity of nodes 6

Graph Theory - History Leonhard Euler's paper on “Seven Bridges of Königsberg” , published in 1736.

“The traveling salesman problem” Famous problems “The traveling salesman problem” A traveling salesman is to visit a number of cities; how to plan the trip so every city is visited once and just once and the whole trip is as short as possible ?

Graph Theory Euler Trails and Circuits Ex. The Seven Bridge of Konigsberg area a area b area d area c a Find a way to walk about the city so as to cross each bridge exactly once and then return to the starting point. b d c

Pencil Drawing Problem -Euler Paths Which of the following pictures can be drawn on paper without ever lifting the pencil and without retracing over any segment?

Introduction to graph theory Graph – mathematical object consisting of a set of: V = nodes (vertices, points). E = edges (links, arcs) between pairs of nodes. Denoted by G = (V, E). Captures pairwise relationship between objects. Graph size parameters: n = |V|, m = |E|.

Introduction to graph theory Graph – mathematical object consisting of a set of: V = nodes (vertices, points). E = edges (links, arcs) between pairs of nodes. Denoted by G = (V, E). Captures pairwise relationship between objects. Graph size parameters: n = |V|, m = |E|. 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

Directed Graph (digraph) Edges have directions An edge is an ordered pair of nodes loop multiple arc arc node

The number of odd degree vertices is even Graph Theory Undirected graph Directed graph loop isolated vertex multiple edges G=(V,E) simple graph: an undirected graph without loop or multiple edges degree of a vertex: number of edges connected (indegree, outdegree) The number of odd degree vertices is even

Graph e1 e2 Edge-labels distinguish between edges sharing same endpoints. Labeling can be thought of as function: e1  {1,2}, e2  {1,2}, e3  {1,3}, e4  {2,3}, e5  {2,3}, e6  {1,2} 1 2 e3 e4 e5 e6 3 4

Digraphs A: Each edge is directed so an ordered pair (or tuple) rather than unordered pair. Thus the set of edges E is just the represented relation on V. (2,2) 2 (2,3) (1,2) (1,3) (1,1) (3,3) 1 3 (2,4) (3,4) 4 (4,4)

Simple graph Local computer network {1,2} Has no loops (no “self-communication”) Has unique connections between computers Vertices are labeled to associate with particular computers Draw the graph with degree 3, 3, 1, 2 & 3, 3, 1, 3 1 2 {2,3} {1,3} {2,4} {3,4} 3 4 {1,4}

Weighted Graph A weighted graph is a graph for which each edge has an associated weight, usually given by a weight function w: E  R 2 2 0.5 2 1.2 4 6 3 3 1 0.2 1 9 2.1 8 4 4

Page Rank Determine the value of a page based on link analysis Model of randomly traversing a graph Weighting factors on nodes Damping (random transitions)

Graph Theory a path: no vertex can be repeated a-b-c-d-e trail: no edge can be repeat a-b-c-d-e-b-d walk: no restriction a-b-d-a-b-c e b d c length: number of edges in this (path,trail,walk) closed trail: circuit (a-b-c-d-b-e-d-a, one draw without lifting pen) closed path: cycle (a-b-c-d-a)

Connected Graph Let G=(V,E) be an undirected graph. We call G connected if there is a path between any two distinct vertices of G. a e a e b b disconnected with two components d d c c

Connectivity Q: Which of the following graphs are connected? 1 2 3 4

Connectivity in Directed Graphs Q: Classify the connectivity of each graph.

English Connectivity Puzzle Can define a puzzling graph G as follows: V = {3-letter English words} E : two words are connected if can get one word from the other by changing a single letter. One small subgraph of G is: Q: Is “fun” connected to “car” ? rob job jab

Handshaking Theorem e6 e1 e2 e5 e3 e4 e7 There are two ways to count the number of edges in the above graph: Just count the set of edges: 7 Count seeming edges vertex by vertex and divide by 2 because double-counted edges: ( deg(1)+deg(2)+deg(3)+deg(4) )/2 = (3+7+2+2)/2 = 14/2 = 7 e2 1 2 e5 e3 e4 e7 3 4

Degree sequence Find a graph with degree sequence 3, 3, 2, 1, 1 3, 3, 3, 3, 3

Handshaking Theorem Lemma: The number of vertices of odd degree must be even in an undirected graph. Proof : Otherwise would have 2|E | = Sum of even no.’s + an odd number of odd no.’s even = even + odd –this is impossible. 

Cycles - Cn The cycle graph Cn is a closed walk does not have repeated vertex: C1 C2 C3 C4 C5

Graph Patterns Wheels - Wn The wheel graph Wn is just a cycle graph with an extra vertex in the middle: W1 W2 W3 W4 W5 Usually consider wheels with 3 or more spokes only.

Bipartite Graphs A simple graph is bipartite if V can be partitioned into V = Z1 W2 so that There is no edge from zi to zj There is no edge from wi to wj There is an edge rom vk to wh The total degree o any graph is even

Bipartite Graph A bipartite graph is an undirected graph G = (V,E) in which V can be partitioned into 2 sets V1 and V2 such that ( u,v)  E implies either u  V1 and v  V2 OR v  V1 and u  V2. V1 V2 u1 v1 u2 v2 u3 v3 u4 An example of bipartite graph application to telecommunication problems can be found in, C.A. Pomalaza-Ráez, “A Note on Efficient SS/TDMA Assignment Algorithms,” IEEE Transactions on Communications, September 1988, pp. 1078-1082. For another example of bipartite graph applications see the slides in the Addendum section

Bipartite Graphs EG: C4 is a bichromatic: And so is bipartite, if we redraw it:

Bipartite Graphs EG: C4 is a bichromatic: And so is bipartite, if we redraw it:

Bipartite Graphs EG: C4 is a bichromatic: And so is bipartite, if we redraw it:

Bipartite Graphs EG: C4 is a bichromatic: And so is bipartite, if we redraw it:

Bipartite Graphs EG: C4 is a bichromatic: And so is bipartite, if we redraw it:

Bipartite Graphs EG: C4 is a bichromatic: And so is bipartite, if we redraw it: Q: For which n is Cn bipartite?

Subgraphs Notice that the 2-cube occurs inside the 3-cube . In other words, Q2 is a subgraph of Q3 : DEF: Let G = (V,E ) and H = (W,F ) be graphs. H is said to be a subgraph of G, if W  V and F  E. Q: How many Q2 subgraphs does Q3 have?

Unions In previous example can actually reconstruct the 3-cube from its 6 2-cube faces:

Graph Isomorphism Two graphs are isomorphic (equivalence) if can bend, stretch and reposition vertices of the first graph, until the second graph is formed. Etymologically, isomorphic means “same shape”. EG: Can twist or relabel: to obtain:

Isomorphism of Graphs For this purpose we can check invariants, that is, properties that two isomorphic simple graphs must both have. the same number of vertices, the same number of edges, and the same degrees of vertices. Note that two graphs that differ in any of these invariants are not isomorphic, but two graphs that match in all of them are not necessarily isomorphic.

Graph Isomorphism -Example EG: Prove that is isomorphic to . First label the vertices: 2 2 1 3 1 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. 2 2 1 1 3 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. The next vertex seen is 3, not 2 so set f (2) = 3. 2 2 1 1 3 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. The next vertex seen is 3, not 2 so set f (2) = 3. Next vertex is 5 so set f (3) = 5. 2 2 1 3 1 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. The next vertex seen is 3, not 2 so set f (2) = 3. Next vertex is 5 so set f (3) = 5. In this fashion we get f (4) = 2 2 2 1 3 1 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. The next vertex seen is 3, not 2 so set f (2) = 3. Next vertex is 5 so set f (3) = 5. In this fashion we get f (4) = 2, f (5) = 4. 2 2 1 3 1 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. The next vertex seen is 3, not 2 so set f (2) = 3. Next vertex is 5 so set f (3) = 5. In this fashion we get f (4) = 2, f (5) = 4. If we would continue, we would get back to f (1) =1 so this process is well defined and f is a morphism. 2 2 1 1 3 3 5 4 5 4

Graph Isomorphism -Example Next, set f (1) = 1 and try to walk around clockwise on the star. The next vertex seen is 3, not 2 so set f (2) = 3. Next vertex is 5 so set f (3) = 5. In this fashion we get f (4) = 2, f (5) = 4. If we would continue, we would get back to f (1) =1 so this process is well defined and f is a morphism. Finally since f is bijective, f is an isomorphism. 2 2 1 3 1 3 5 4 5 4

Isomorphism of Graphs Are the following two graphs isomorphic? d a b c Solution: Yes, they are isomorphic, because they can be arranged to look identical. You can see this if in the right graph you move vertex b to the left of the edge {a, c}. Then the isomorphism f from the left to the right graph is: f(a) = e, f(b) = a, f(c) = b, f(d) = c, f(e) = d.

Isomorphism of Graphs How about these two graphs? d a b c e d a b c e Solution: No, they are not isomorphic, because they differ in the degrees of their vertices. Vertex d in right graph is of degree one, but there is no such vertex in the left graph.

Isomorphism Problem Determining whether two graphs are isomorphic Although these graphs look very different, they are isomorphic; one isomorphism between them is f(a) = 1 f(b) = 6 f(c) = 8 f(d) = 3 f(g) = 5 f(h) = 2 f(i) = 4 f(j) = 7

1-e12-e11-e33-e42-e62-e52-e43 Paths A path in a graph is a continuous way of getting from one vertex to another by using a sequence of edges. EG: could get from 1 to 3 circuitously as follows: 1-e12-e11-e33-e42-e62-e52-e43 e6 e1 e2 1 2 e5 e3 e4 e7 3 4

Paths A: For simple graphs, any edge is unique between vertices so listing the vertices gives us the edge-sequence as well. DEF: A simple path contains no duplicate edges (though duplicate vertices are allowed). A cycle (or circuit) is a path which starts and ends at the same vertex. Note: Simple paths need not be in simple graphs. E.g., may contain loops.

a. Find out the truth value of (p˄q) ⊕ (p˅q), when p is known to be true and q is known to be false b. Show that ((p ˅ q) ˄ (p  q))  q, is a tautology.

Let P(x) , Q(x), and R(x) be the statements x is a duck, x is annoying, and x is a dancer, respectively. Express each of these statements using quantifiers, logical connectives, and P(x) , Q(x), and R(x) a) All ducks are annoying. b) Some dancers are not annoying. c) Some dancers are not ducks.