LOGO.  Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
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.
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
1 Section 8.2 Graph Terminology. 2 Terms related to undirected graphs Adjacent: 2 vertices u & v in an undirected graph G are adjacent (neighbors) in.
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.
Applied Discrete Mathematics Week 12: Trees
Graphs.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
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.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
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,
1 Graphs Chapters 9.1 and 9.2 University of Maryland Chapters 9.1 and 9.2 Based on slides by Y. Peng University of Maryland.
Graph Theory 4/23/2017.
16.1 CompSci 102© Michael Frank Today’s topics GraphsGraphs –Basics & types –Properties –Connectivity –Hamilton & Euler Paths Reading: Sections Reading:
Module #19: Graph Theory: part I Rosen 5 th ed., chs. 8-9 내년 3 월 ? 교환 학생 프로그램 영어 점수 미리미리 준비하세요.
1 Elements of Graph Theory Quick review of Chapters 9.1… 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
1 CS104 : Discrete Structures Chapter V Graph Theory.
9.1 Introduction to Graphs
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
GRAPHS THEROY. 2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
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.
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
Discrete Structures Graphs 1 (Ch. 10) Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
1 Graphs Theory UNIT IV. 2Contents  Basic terminology,  Multi graphs and weighted graphs  Paths and circuits  Shortest path in weighted graph  Hamiltonian.
Graph Theory and Applications
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.
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
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.
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Chapter 9: Graphs.
Euler and Hamiltonian Graphs
Graphs Rosen, Chapter 8. NOT ONE OF THESE! One of these!
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.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
GRAPH THEORY Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
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
Graphs: Definitions and Basic Properties
Chapter 9 (Part 2): Graphs
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
COT 3100, Spring 2001 Applications of Discrete Structures
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Graphs Rosen, Chapter 8.
Graph theory Definitions Trees, cycles, directed graphs.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Rosen 5th ed., chs. 8-9 ~44 slides (more later), ~3 lectures
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Graph & Trees Chapters 10-11
CS100: Discrete structures
Rosen 5th ed., ch. 8.1~8.5 ~44 slides (more later), ~3 lectures
Presentation transcript:

LOGO

 Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton paths 2

LOGO 3

What are Graphs?  General meaning in everyday math: A plot or chart of numerical data using a coordinate system.

LOGO What are Graphs?  General meaning in everyday math: A plot or chart of numerical data using a coordinate system.  Technical meaning in discrete mathematics: A particular class of discrete structures (to be defined) that is useful for representing relations and has a convenient graphical representation.

LOGO 6 What are Graphs?  General meaning in everyday math: A plot or chart of numerical data using a coordinate system.  Technical meaning in discrete mathematics: A particular class of discrete structures (to be defined) that is useful for representing relations and has a convenient graphical representation. Not

LOGO 7 Applications of Graphs  (At least) anything that can be modelled using 1- or 2-place relations.  Apps in networking, scheduling, flow optimization, circuit design, path planning, search; genealogy, any kind of taxonomy, …  Challenge: name a topic that graphs cannot model

LOGO 8  We shall introduce a number of different types of graphs, starting with undirected graphs:  “simple” graphs  multigraphs  pseudographs

LOGO 9 Simple Graphs  Correspond to symmetric, irreflexive binary relations R.  A simple graph G=(V,E) consists of:  a set V of vertices or nodes (V corresponds to the universe of the relation R),  a set E of edges: unordered pairs of distinct elements u,v  V, such that uRv.

LOGO 10 Simple Graphs  Correspond to symmetric, irreflexive binary relations R.  A simple graph G=(V,E) consists of:  a set V of vertices or nodes (V corresponds to the universe of the relation R),  a set E of edges: unordered pairs of distinct elements u,v  V, such that uRv. Visual Representation of a Simple Graph

LOGO 11  Let V be the set of states in the far- southeastern U.S.:  I.e., V={FL, GA, AL, MS, LA, SC, TN, NC}  Let E={{u,v}|u adjoins v} ={{FL,GA},{FL,AL},{FL,MS}, {FL,LA},{GA,AL},{AL,MS}, {MS,LA},{GA,SC},{GA,TN}, {SC,NC},{NC,TN},{MS,TN}, {MS,AL}} Example of a Simple Graph TN AL MS LA SC GA FL NC

LOGO 12 Extensions  All the main types of graphs can be extended to make them more expressive

LOGO 13 Extensions  All the main types of graphs can be extended to make them more expressive  For example, edges may be labelled: Labelled graphs

LOGO 14 Extensions  All the main types of graphs can be extended to make them more expressive  For example, edges may be labelled: Labelled graphs  E.g., the edges in the previous example may be labelled with the type of border (e.g., patrolled/non-patrolled)

LOGO 15 Multigraphs  Like simple graphs, but there may be more than one edge connecting two given nodes.  A multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges (as primitive objects), and a function f:E  {{u,v}|u,v  V  u  v}.  E.g., nodes are cities, edges are segments of major highways. Parallel edges

LOGO 16 Multigraphs extended  Extension: edges may be labelled with numbers of miles. How about this example? BA C

LOGO 17 Multigraphs extended  Can go from A to B via C in less than 110. The distances in the graph are not minimal, or something is wrong BA C

LOGO 18 Pseudographs  Like a multigraph, but edges connecting a node to itself are allowed. (R may even be reflexive.)  A pseudograph G=(V, E, f ) where f:E  {{u,v}|u,v  V}. Edge e  E is a loop if f(e)={u,u}={u}.  E.g., nodes are campsites in a state park, edges are hiking trails through the woods.

LOGO 19 Pseudographs  Like a multigraph, but edges connecting a node to itself are allowed. (R may even be reflexive.)  A pseudograph G=(V, E, f ) where f:E  {{u,v}|u,v  V}. Edge e  E is a loop if f(e)={u,u}={u}.  E.g., nodes are campsites in a state park, edges are hiking trails through the woods.

LOGO 20 Directed Graphs  Correspond to arbitrary binary relations R, which need not be symmetric.

LOGO 21 Directed Graphs  Correspond to arbitrary binary relations R, which need not be symmetric.  A di(rected) graph (V,E) consists of a set of vertices V and a binary relation E on V.  E.g.: V = set of People, E={(x,y) | x loves y}

LOGO 22 Directed Graphs  Correspond to arbitrary binary relations R, which need not be symmetric.  A di(rected) graph (V,E) consists of a set of vertices V and a binary relation E on V.  E.g.: V = set of People, E={(x,y) | x loves y}

LOGO 23 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.

LOGO 24 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.  A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:E  V  V.

LOGO 25 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.  A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:E  V  V.  E.g., V=web pages, E=hyperlinks. The WWW as a directed multigraph...

LOGO 26 Directed Multigraphs  Like directed graphs, but there may be more than one edge from a node to another.  A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:E  V  V.  E.g., V=web pages, E=hyperlinks. The WWW as a directed multigraph...

LOGO 27 Types of Graphs: Summary  Summary of the book’s definitions.  This terminology is not fully standardized across different authors

LOGO 28

LOGO 29 Graph Terminology Introducing the following terms:  Adjacent, connects, endpoints, degree, initial, terminal, in-degree, out-degree, complete, cycles, wheels, n-cubes, bipartite, subgraph, union.

LOGO 30 Adjacency Let G be an undirected graph with edge set E. Let e  E be (or map to) the pair {u,v}. Then we say:  u, v are adjacent / connected.  Edge e is incident with vertices u and v.  Edge e connects u and v.  Vertices u and v are endpoints of edge e.

LOGO 31 Degree of a Vertex  Let G be an undirected graph, v  V a vertex.  The degree of v, deg(v), is its number of incident edges. (Except that any self-loops are counted twice.)  A vertex with degree 0 is called isolated.  A vertex of degree 1 is called pendant.

LOGO 32 Degree of a Vertex  The degree of v, deg(v), is its number of incident edges. (Except that any self-loops are counted twice.)  Exercise: construct a pseudograph with three vertices, all of which have different degrees.

LOGO 33 Handshaking Theorem  Let G be an undirected (simple, multi-, or pseudo-) graph with vertex set V and edge set E. Then  Proof: every edge causes degree:= degree +2

LOGO 34 Handshaking Theorem  Let G be an undirected (simple, multi-, or pseudo-) graph with vertex set V and edge set E. Then  Corollary: Any undirected graph has an even number of vertices of odd degree.

LOGO 35 `Sociological’ example  (Like previous exercise, this is from Jonathan L.Gross’ coursenotes to Rosen) Suppose the students in this class are represented as vertices. An edge between a and b means that a and b were acquainted before the course began. [This is a simple graph.]  How many students knew an odd number of other students? Could there be 3?

LOGO 36 `Sociological’ example  (Like previous exercise, this is from Jonathan L.Gross’ coursenotes to Rosen) Suppose the students in this class are represented as vertices. An edge between a and b means that a and b were acquainted before the course began. [This is a simple graph.]  [By corollary to handshaking theorem:] The number of students who knew an odd number of other students is even.

LOGO 37 Directed Adjacency  Let G be a directed (possibly multi-) graph, and let e be an edge of G that is (or maps to) (u,v). Then we say:  u is adjacent to v, v is adjacent from u  e comes from u, e goes to v.  e connects u to v, e goes from u to v  the initial vertex of e is u  the terminal vertex of e is v

LOGO 38 Directed Degree  Let G be a directed graph, v a vertex of G.  The in-degree of v, deg  (v), is the number of edges going to v.  The out-degree of v, deg  (v), is the number of edges coming from v.  The degree of v, deg(v):  deg  (v)+deg  (v), is the sum of v’s in-degree and out-degree.

LOGO 39 Directed Handshaking Theorem  Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then:

LOGO 40 Directed Handshaking Theorem  Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then:

LOGO 41 Directed Handshaking Theorem  Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then:  Note that the degree of a node is unchanged by whether we consider its edges to be directed or undirected.

LOGO 42 Special Graph Structures Special cases of undirected graph structures:  Complete graphs K n  Cycles C n  Wheels W n  n-Cubes Q n  Bipartite graphs  Complete bipartite graphs K m,n

LOGO 43 Complete Graphs  For any n  N, a complete graph on n vertices, K n, is a simple graph with n nodes in which every node is adjacent to every other node:  u,v  V: u  v  {u,v}  E.

LOGO 44 Complete Graphs  For any n  N, a complete graph on n vertices, K n, is a simple graph with n nodes in which every node is adjacent to every other node:  u,v  V: u  v  {u,v}  E. K1K1 K2K2 K3K3 K4K4 K5K5 K6K6

LOGO 45 Complete Graphs  For any n  N, a complete graph on n vertices, K n, is a simple graph with n nodes in which every node is adjacent to every other node:  u,v  V: u  v  {u,v}  E. K1K1 K2K2 K3K3 K4K4 K5K5 K6K6 Note that K n has edges.

LOGO 46  Consider a complete graph G=(V,E). Can E contain any edges connecting a node in V to itself?

LOGO 47  Consider a complete graph G=(V,E). Can E contain any edges connecting a node in V to itself?  No: this would mean {u,v}  E, where u=v hence  u,v  V: u  v  {u,v}  E.

LOGO 48  Can you think of a natural example where complete graphs might model the facts?

LOGO 49  Can you think of a natural example where complete graphs might model the facts?  E.g., Graphs that model, for groups of n people, which people are seen by each member of the group

LOGO 50 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}.

LOGO 51 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}. C3C3 C4C4 C5C5 C6C6 C7C7 C8C8

LOGO 52 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}. C3C3 C4C4 C5C5 C6C6 C7C7 C8C8 How many edges are there in C n ?

LOGO 53 Cycles  For any n  3, a cycle on n vertices, C n, is a simple graph where V={v 1,v 2,…,v n } and E={{v 1,v 2 },{v 2,v 3 },…,{v n  1,v n },{v n,v 1 }}. C3C3 C4C4 C5C5 C6C6 C7C7 C8C8 How many edges are there in C n ? n

LOGO 54  Can you think of a natural example where cycles might model the facts?  E.g., Graphs that model, for groups of n people, which people are sitting next to each other (on a round table)

LOGO 55  Can a cycle be a complete graph?

LOGO 56  Can a cycle be a complete graph?  Yes: every cycle with exactly 3 elements is a complete graph.  No other cycle can be a complete graph.

LOGO 57  Can a cycle be a complete graph?  Yes: every cycle with exactly 3 elements is a complete graph.  No other cycle can be a complete graph. Can be proven by proving with induction that: |Edges(C_n)| 2.

LOGO 58 Wheels  For any n  3, a wheel W n, is a simple graph obtained by taking the cycle C n and adding one extra vertex v hub and n extra edges {{v hub,v 1 }, {v hub,v 2 },…,{v hub,v n }}. W3W3 W4W4 W5W5 W6W6 W7W7 W8W8

LOGO 59 Wheels  For any n  3, a wheel W n, is a simple graph obtained by taking the cycle C n and adding one extra vertex v hub and n extra edges {{v hub,v 1 }, {v hub,v 2 },…,{v hub,v n }}. W3W3 W4W4 W5W5 W6W6 W7W7 W8W8 How many edges are there in W n ?

LOGO 60 Wheels  For any n  3, a wheel W n, is a simple graph obtained by taking the cycle C n and adding one extra vertex v hub and n extra edges {{v hub,v 1 }, {v hub,v 2 },…,{v hub,v n }}. W3W3 W4W4 W5W5 W6W6 W7W7 W8W8 How many edges are there in W n ? 2n

LOGO 61  Definition: A graph is regular iff every vertex has the same degree.

LOGO 62  Which of these are regular? (What degree?)  Complete graphs?  Cycle graphs?  Wheel graphs?

LOGO 63  Which of these are regular? (What degree?)  Complete graphs? Yes: degree n-1 (for n nodes)  Cycle graphs? Yes: degree 2  Wheel graphs? No, except when they have 3 nodes

LOGO 64 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node.

LOGO 65 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node. Q0Q0 Q1Q1 Q2Q2 Q3Q3 ? What do you think about Q 4 ?

LOGO 66 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node. Q0Q0 Q1Q1 Q2Q2 Q3Q3 Q4Q4

LOGO 67 n-cubes (hypercubes)  For any n  N, the hypercube Q n is a simple graph consisting of two copies of Q n-1 connected together at corresponding nodes. Q 0 has 1 node. Number of vertices: 2 n. Number of edges:Exercise to try! Q0Q0 Q1Q1 Q2Q2 Q3Q3 Q4Q4

LOGO 68 n-cubes (hypercubes)  For any n  N, the hypercube Q n can be defined recursively as follows:  Q 0 ={{v 0 },  } (one node and no edges)  For any n  N, if Q n =(V,E), where V={v 1,…,v a } and E={e 1,…,e b }, then Q n+1 = …

LOGO 69 n-cubes (hypercubes)  For any n  N, the hypercube Q n can be defined recursively as follows:  Q 0 ={{v 0 },  } (one node and no edges)  For any n  N, if Q n =(V,E), where V={v 1,…,v a } and E={e 1,…,e b }, then Q n+1 = (V  {v 1 ´,…,v a ´}, E  {e 1 ´,…,e b ´}  {{v 1,v 1 ´},{v 2,v 2 ´},…, {v a,v a ´}}) where v 1 ´,…,v a ´ are new vertices, and where if e i ={v j,v k } then e i ´={v j ´,v k ´}.

LOGO 70  Def’n.: A graph G=(V,E) is bipartite (two- part) iff V = V 1  V 2 where V 1 ∩V 2 =  and  e  E:  v 1  V 1,v 2  V 2 : e={v 1,v 2 }. Bipartite Graphs

LOGO 71  Def’n.: A graph G=(V,E) is bipartite (two- part) iff V = V 1  V 2 where V 1 ∩V 2 =  and  e  E:  v 1  V 1,v 2  V 2 : e={v 1,v 2 }.  In Human Mode(!): The graph can be divided into two parts in such a way that all edges go between the two parts. Bipartite Graphs V1V1 V2V2 Can represent with zero-one matrices.

LOGO 72  Def’n.: A graph G=(V,E) is bipartite (two- part) iff V = V 1  V 2 where V 1 ∩V 2 =  and  e  E:  v 1  V 1,v 2  V 2 : e={v 1,v 2 }.  In Human Mode(!): The graph can be divided into two parts in such a way that all edges go between the two parts. Bipartite Graphs V1V1 V2V2 This definition can easily be adapted for the case of multigraphs and directed graphs as well. Can represent with zero-one matrices.

LOGO 73 Bipartite graphs  … are extremely common, for example when you’re modelling a domain that consists of two different kinds of entities  Animals in a zoo, linked with their keepers  Words, linked with numbers of letters in them  Logical formulas, linked with English sentences that express their meaning

LOGO 74 Some questions  Can you think of a graph with two vertices that is not bipartite?  Can you think of a simple graph with two vertices that is not bipartite?  Can you think of a simple graph with three vertices and a nonempty set of edges that is bipartite?

LOGO 75 Some questions  Can you think of a graph with two vertices that is not bipartite? Yes: if there are self-loops  Can you think of a simple graph with two vertices that is not bipartite? No: must be bipartite  Can you think of a simple graph with three vertices and a nonempty set of edges that is bipartite? Yes: as long as it’s not complete

LOGO 76  Given a (bipartite) graph, can there be more than 1 way of partitioning V into V 1 and V 2 ?

LOGO 77  Given a (bipartite) graph, can there be more than 1 way of partitioning V into V 1 and V 2 ?  Yes: isolated vertices can be put in either part: Bipartite Graphs V1V1 V2V2

LOGO 78 Complete Bipartite Graphs  For m,n  N, the complete bipartite graph K m,n is a bipartite graph where |V 1 | = m, |V 2 | = n, and E = {{v 1,v 2 }|v 1  V 1  v 2  V 2 }.  That is, there are m nodes in the left part, n nodes in the right part, and every node in the left part is connected to every node in the right part. K 4,3 K m,n has _____ nodes and _____ edges.

LOGO 79 Complete Bipartite Graphs  For m,n  N, the complete bipartite graph K m,n is a bipartite graph where |V 1 | = m, |V 2 | = n, and E = {{v 1,v 2 }|v 1  V 1  v 2  V 2 }.  That is, there are m nodes in the left part, n nodes in the right part, and every node in the left part is connected to every node in the right part. K 4,3 K m,n has m+n nodes and n*m edges.

LOGO 80 Complete Bipartite Graphs  For m,n  N, the complete bipartite graph K m,n is a bipartite graph where |V 1 | = m, |V 2 | = n, and E = {{v 1,v 2 }|v 1  V 1  v 2  V 2 }.  That is, there are m nodes in the left part, n nodes in the right part, and every node in the left part is connected to every node in the right part. K 4,3 K m,n has m+n nodes and n*m edges. Note: not every CBG is complete! (So “CBG” is a strange name)

LOGO 81 Subgraphs  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E.

LOGO 82 Subgraphs  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E. G

LOGO 83 Subgraphs  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E. G H

LOGO 84  A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E.  Note: since H is a graph, F can only involve nodes that are elements of W.

LOGO 85

LOGO 86 Graph Representations & Isomorphism  Graph representations:  Adjacency lists.  Adjacency matrices. [Not covered this course]  Incidence matrices. [Not covered this course]

LOGO 87 Adjacency Lists  A table with 1 row per vertex, listing its adjacent vertices. a b d c f e

LOGO 88 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar

LOGO 89 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar  Obviously, a given graph (V,E) may be drawn in different ways.

LOGO 90 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar  Obviously, a given graph (V,E) may be drawn in different ways.  But even (V,E) and (V’,E’) (where V<>V’ and E<>E’) may in some sense be equivalent:

LOGO 91 An equivalence relation between graphs  Unlike ordinary pictures, we can say precisely when two graphs are similar  Obviously, a given graph (V,E) may be drawn in different ways.  But even (V,E) and (V’,E’) (where V<>V’ and E<>E’) may in some sense be equivalent:  Graph isomorphism (informal):  Two graphs are isomorphic iff they are identical except for their node names.

LOGO 92  Graphs that are isomorphic share all their `important’ properties, e.g.,  The number of nodes and edges  The degrees of all their nodes  Whether they are bipartite or not, etc.

LOGO 93  Graphs that are isomorphic share all their `important’ properties, e.g.,  The number of nodes and edges  The degrees of all their nodes  Whether they are bipartite or not, etc.  How would you define graph isomorphism formally?  For simplicity: focus on simple graphs  Hint: use the notion of a bijection

LOGO 94 Graph Isomorphism  Formal definition:  Simple graphs G 1 =(V 1, E 1 ) and G 2 =(V 2, E 2 ) are isomorphic iff  a bijection f:V 1  V 2 such that  a,b  V 1, a and b are adjacent in G 1 iff f(a) and f(b) are adjacent in G 2.  f is the “renaming” function between the two node sets that makes the two graphs identical.  This definition can be extended to other types of graphs.

LOGO 95 Graph Isomorphism  How can we tell whether two graphs are isomorphic?  The best algorithms that are known to solve this problem have exponential worst-case time complexity. (Faster solutions may be possible.)  In practice, a few tests go a long way …

LOGO 96 Graph Invariants under Isomorphism Necessary but not sufficient conditions for G 1 =(V 1, E 1 ) to be isomorphic to G 2 =(V 2, E 2 ):  |V1|=|V2| and |E1|=|E2|.  The number of vertices with degree n is the same in both graphs.  For every proper subgraph g of one graph, there is a proper subgraph of the other graph that is isomorphic to g.

LOGO 97 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f

LOGO 98 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f d

LOGO 99 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f d f

LOGO 100 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d f

LOGO 101 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d a f

LOGO 102 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d a e f

LOGO 103 Isomorphism Example  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e f b d a e f c

LOGO 104 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e

LOGO 105 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices

LOGO 106 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges

LOGO 107 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

LOGO 108 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

LOGO 109 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

LOGO 110 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

LOGO 111 Are These Isomorphic?  If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. a b c d e Same # of vertices Same # of edges Different # of verts of degree 2! (1 vs 3)

LOGO 112  We now jump to the area that gave raise to the invention of (a formal theory of) graphs  Questions like  “Can I travel from a to b?”  “Can I go travel a to b without going anywhere twice?”  “What’s the quickest route from a to b?”

LOGO 113

LOGO 114 Connectivity  In an undirected graph, a path of length n from u to v is a sequence of adjacent edges going from vertex u to vertex v.  A path is a circuit if u=v.  A path traverses the vertices along it.  A path is simple if it contains no edge more than once.

LOGO 115 Connectedness  An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph.

LOGO 116 Connectedness  An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph.  Theorem: There is a simple path between any pair of vertices in a connected undirected graph.

LOGO 117 Directed Connectedness  A directed graph is strongly connected iff there is a directed path from a to b for any two verts a and b.

LOGO 118 Directed Connectedness  A directed graph is strongly connected iff there is a directed path from a to b for any two verts a and b.  It is weakly connected iff the underlying undirected graph (i.e., with edge directions removed) is connected.

LOGO 119 Paths & Isomorphism  Note that connectedness, and the existence of a circuit or simple circuit of length k are graph invariants with respect to isomorphism.

LOGO 120

LOGO 121 Euler & Hamilton Paths  We’ll show you the problem that prompted Euler to invent the theory of graphs: the bridges of Koenigsberg (town later called Kaliningrad)

LOGO 122 Bridges of Königsberg Problem  Can we walk through town, crossing each bridge exactly once, and return to start?

LOGO 123 Bridges of Königsberg Problem  Can we walk through town, crossing each bridge exactly once, and return to start? Can you model the situation using a graph? A B C D The original problem

LOGO 124 Bridges of Königsberg Problem  Can we walk through town, crossing each bridge exactly once, and return to start? A B C D The original problem Equivalent multigraph

LOGO 125 Euler & Hamilton Paths Terminology:  An Euler circuit in a graph G is a simple circuit containing every edge of G.  An Euler path in G is a simple path containing every edge of G.

LOGO 126 Bridges of Koenigsberg  Bridges are edges. So the answer to the problem is YES iff its graph contains an Euler circuit.  In fact, it does not …

LOGO 127 Euler Path Theorems  Theorem: A finite connected multigraph has an Euler circuit iff each vertex has even degree.  Proof: (→) The circuit contributes 2 to degree of each node. (←) By construction using algorithm on p  Theorem: A connected multigraph has an Euler path iff it has exactly 2 vertices of odd degree.  One is the start, the other is the end.

LOGO 128 Not all edges have even degree … so there is no Euler circuit. A B C D The original problem Equivalent multigraph

LOGO 129 Euler Circuit theorem  Sketch of proof that even degree implies existence of Euler circuit:  Start with any arbitrary node. Construct simple path from it till you get back to start. (Graph is connected; every node has even degree, so you can leave any node that you have entered)  Repeat for each remaining subgraph, splicing results back into original cycle. Finiteness of graph implies that this process must end.  Note that the complete version of this proof provides an algorithm: it’s a constructive proof of an existential proposition

LOGO 130 Hamilton Paths  An Euler circuit in a graph G is a simple circuit containing every edge of G.  An Euler path in G is a simple path containing every edge of G.  A Hamilton circuit is a circuit that traverses each vertex in G exactly once.  A Hamilton path is a path that traverses each vertex in G exactly once.

LOGO 131 Hamiltonian Path Theorems  Dirac’s theorem: If (but not only if) G is connected, simple, has n  3 vertices, and  v deg(v)  n/2, then G has a Hamilton circuit.  Ore’s corollary: If G is connected, simple, has n≥3 nodes, and deg(u)+deg(v)≥n for every pair u,v of non-adjacent nodes, then G has a Hamilton circuit.

LOGO  You will learn about the following topics in graphs later in other courses:  shortest-path problem  Graph coloring 132

LOGO Good Luck