Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 211 Discrete Mathematics Introduction to Graphs Chapter 8- Rosen Chapter 8,9- Schaums Outlines.

Similar presentations


Presentation on theme: "CSE 211 Discrete Mathematics Introduction to Graphs Chapter 8- Rosen Chapter 8,9- Schaums Outlines."— Presentation transcript:

1 CSE 211 Discrete Mathematics Introduction to Graphs Chapter 8- Rosen Chapter 8,9- Schaums Outlines

2 What is Graph? A graph G = (V, E) consists of a set of objects V = {v 1, v 2, …} called vertices, and another set E = {e 1, e 2, …}, whose elements are called edges, such that each edge e k is identified with an unordered pair (v 1, v 2 ) of vertices. Suppose G = (V, E) is a graph where V = {v 1, v 2, v 3, v 4 } E = {(v 1, v 2 ), (v 2, v 3 ), (v 3, v 1 ), (v 3, v 4 )} V1V1 V2V2 V3V3 V4V4

3 Applications

4 Scheduling

5 Applications Job assignments People Jobs

6 The House-and-Utilities Problem

7 Applications Utilities Problem W G E H1H1 H2H2 H3H3

8 Simple Graph Example This simple graph represents a network. The network is made up of computers and telephone links between computers San Francisco Denver Los Angeles New York Chicago Washington Detroit

9 Multigraph A multigraph can have multiple edges (two or more edges connecting the same pair of vertices). San Francisco Denver Los Angeles New York Chicago Washington Detroit There can be multiple telephone lines between two computers in the network.

10 Pseudograph A Pseudograph can have multiple edges and loops (an edge connecting a vertex to itself). There can be telephone lines in the network from a computer to itself. San Francisco Denver Los Angeles New YorkChicago Washington Detroit

11 Pseudographs Multigraphs Types of Undirected Graphs Simple Graphs

12 Directed Graph The edges are ordered pairs of (not necessarily distinct) vertices. San Francisco Denver Los Angeles New York Chicago Washington Detroit Some telephone lines in the network may operate in only one direction. Those that operate in two directions are represented by pairs of edges in opposite directions.

13 Directed Multigraph A directed multigraph is a directed graph with multiple edges between the same two distinct vertices. San Francisco Denver Los Angeles New York Chicago Washington Detroit There may be several one-way lines in the same direction from one computer to another in the network.

14 Types of Directed Graphs Directed Multigraphs Directed Graphs

15 Graph Models Graphs can be used to model structures, sequences, and other relationships. Example: ecological niche overlay graph –Species are represented by vertices –If two species compete for food, they are connected by a vertex

16 Niche Overlay Graph

17 Acquaintanceship Graph

18 Influence Graph

19 Round-Robin Tournament Graph

20 Call Graphs Directed graph (a) represents calls from a telephone number to another. Undirected graph (b) represents called between two numbers.

21 Precedence Graphs In concurrent processing, some statements must be executed before other statements. A precedence graph represents these relationships.

22 Hollywood Graph In the Hollywood graph: –Vertices represent actors –Edges represent the fact that the two actors have worked together on some movie As of October 2007, this graph had 893,283 vertices, and over 20 million edges.

23 Summary TypeEdgesLoopsMultiple Edges Simple GraphUndirectedNO MultigraphUndirectedNOYES PseudographUndirectedYES Directed Graph DirectedYESNO

24 CSE 211 Discrete Mathematics Chapter 8.2 Graph Terminology

25 Finite Graph: Finite number of vertices had finite number of edges Trivial Graph: –The finite graph with one vertex and no edge

26 Adjacent Vertices in Undirected Graphs Two vertices, u and v in an undirected graph G are called adjacent (or neighbors) in G, if {u,v} is an edge of G. An edge e connecting u and v is called incident with vertices u and v, or is said to connect u and v. The vertices u and v are called endpoints of edge {u,v}.

27 Degree of a Vertex The degree of a vertex in an undirected graph is the number of edges incident with it –except that a loop at a vertex contributes twice to the degree of that vertex The degree of a vertex v is denoted by deg(v).

28 Example Find the degrees of all the vertices: deg(a) = 2, deg(b) = 6, deg(c) = 4, deg(d) = 1, deg(e) = 0, deg(f) = 3, deg(g) = 4 a b g e c d f

29 Adjacent Vertices in Directed Graphs When (u,v) is an edge of a directed graph G, u is said to be adjacent to v and v is said to be adjacent from u. initial vertexterminal vertex (u, v)

30 Degree of a Vertex In-degree of a vertex v –The number of vertices adjacent to v (the number of edges with v as their terminal vertex –Denoted by deg (v) Out-degree of a vertex v –The number of vertices adjacent from v (the number of edges with v as their initial vertex) –Denoted by deg + (v) A loop at a vertex contributes 1 to both the in- degree and out-degree.

31 Example

32 a c b e d f Find the in-degrees and out-degrees of this digraph. In-degrees: deg - (a) = 2, deg - (b) = 2, deg - (c) = 3, deg - (d) = 2, deg - (e) = 3, deg - (f) = 0 Out-degrees: deg + (a) = 4, deg + (b) = 1, deg + (c) = 2, deg + (d) = 2, deg + (e) = 3, deg + (f) = 0 Example

33 Handshaking Theorem In an undirected graph An undirected graph has an even number of vertices of odd degree:

34 a b g e c d f Handshaking Theorem Find the degrees of all the vertices: deg(a) = 2, deg(b) = 6, deg(c) = 4, deg(d) = 1, deg(e) = 0, deg(f) = 3, deg(g) = 4 So ( )/2=20/2=10

35 Theorem 3 The sum of the in-degrees of all vertices in a digraph = the sum of the out-degrees = the number of edges. Let G = (V, E) be a graph with directed edges. Then:

36 Complete Graph The complete graph on n vertices (K n ) is the simple graph that contains exactly one edge between each pair of distinct vertices. The figures above represent the complete graphs, K n, for n = 1, 2, 3, 4, 5, and 6.

37 Cycle The cycle C n (n 3), consists of n vertices v 1, v 2, …, v n and edges {v 1,v 2 }, {v 2,v 3 }, …, {v n-1,v n }, and {v n,v 1 }. C3C3 C4C4 C5C5 C6C6 Cycles:

38 Wheel When a new vertex is added to a cycle C n and this new vertex is connected to each of the n vertices in C n, we obtain a wheel W n. W3W3 W4W4 W6W6 W5W5 Wheels:

39 Bipartite Graph A simple graph is called bipartite if its vertex set V can be partitioned into two disjoint nonempty sets V 1 and V 2 such that every edge in the graph connects a vertex in V 1 and a vertex in V 2 (so that no edge in G connects either two vertices in V 1 or two vertices in V 2 ). a b c d e bcbc adeade

40 Graph Theoretic Foundations Bipartite Graph

41 Graph Theoretic Foundations Bipartite Graph Complete bipartite graph

42 Bipartite Graph (Example) Is C 6 Bipartite? Yes. Why? Because: its vertex set can be partitioned into the two sets V 1 = {v 1, v 3, v 5 } and V 2 = {v 2, v 4, v 6 } every edge of C 6 connects a vertex in V 1 with a vertex in V

43 Bipartite Graph (Example) Is K 3 Bipartite? No. Why not? Because: Each vertex in K 3 is connected to every other vertex by an edge If we divide the vertex set of K 3 into two disjoint sets, one set must contain two vertices These two vertices are connected by an edge But this cant be the case if the graph is bipartite 1 2 3

44 Graph Theoretic Foundations Subgraphs Spanning subgraph of G; since V = V

45 Subgraph A subgraph of a graph G = (V,E) is a graph H = (W,F) where W V and F E. C5C5 K5K5 Is C 5 a subgraph of K 5 ?

46 Union The union of 2 simple graphs G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) is the simple graph with vertex set V = V 1 V 2 and edge set E = E 1 E 2. The union is denoted by G 1 G 2. C5 C5 b a c e d S5S5 a b c e d f W5W5 b d a c e f S 5 C 5 = W 5


Download ppt "CSE 211 Discrete Mathematics Introduction to Graphs Chapter 8- Rosen Chapter 8,9- Schaums Outlines."

Similar presentations


Ads by Google