 # Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.

## Presentation on theme: "Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department."— Presentation transcript:

Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department

2 Objectives On completion of this topic, student should be able to: a.Explain basic terminology of a graph b.Identify Euler and Hamiltonian cycle c.Represent graphs using adjacency matrices

3 Seven Bridges of Königsberg Is it possible for a person to take a walk around town, starting and ending at the same location and crossing each of the seven bridges exactly once? NO

4 Terminology Walk, path, simple path, circuit, simple circuit Walk from two vertices is a finite alternating sequence of adjacent vertices and edges v 0 e 1 v 1 e 2 …e n v n Trivial walk from v to v consists of single vertex Closed walk – starts and ends at same vertex

5 Path Path – a walk that does not contain a repeated edge (may have a repeated vertex) v 0 e 1 v 1 e 2 …e n v n where all the e i are distinct Simple path – a path that does not contain a repeated vertex (and no repeated edge) v 0 e 1 v 1 e 2 …e n v n where all the e i and v j are distinct

6 Example - Path Path v Simple path w

7 Circuit Circuit – a closed walk without repeated edge v 0 e 1 v 1 e 2 …e n v n where e i are distinct and v 0 = v n Simple circuit – a circuit with no repeated vertex except first and last v 0 e 1 v 1 e 2 …e n v n where e i and v j are distinct and v 0 = v n

8 Example - Circuit Circuit Simple circuit

9 Repeated edge?Repeated vertex?Starts and ends at the same point? WalkAllowed PathNoAllowed Simple PathNo Closed WalkAllowed Yes CircuitNoAllowedYes Simple CircuitNoFirst and Last Only Yes

10 Connectedness Connectedness – if there is a walk from one to the other Let G be a graph. Two vertices v and w of G are connected iff there is a walk from v to w The graph G is connected iff given any two vertices v and w in G, there is a walk from v to w G is connected   vertices, v, w  V(G),  a walk from v to w

11 Example - Connectedness

12 Euler Circuits A circuit that contains every vertex and every edge of G A sequence of adjacent vertices and edges that 1.starts and ends at the same vertex, 2.uses every vertex of G at least once, and 3.uses every edge of G exactly once

13 If a Graph has an Euler Circuit, every Vertex has Even Degree. Contrapositive: if some vertex has odd degree, then the graph does not have an Euler circuit.

14 Theorem: Euler Circuits If a graph has an Euler Circuit, every vertex has even degree Contrapositive: if some vertex has odd degree, then the graph does not have an Euler circuit. If every vertex of nonempty graph has even degree and if graph is connected, then the graph has an Euler circuit

15 Theorem: Euler Circuits A graph G has an Euler circuit if, and only if, G is connected and every vertex of G has even degree

16 Hamiltonian Circuit A simple circuit that includes every vertex of G A sequence of adjacent vertices and distinct edges in which every vertex of G appears exactly once, except for the first and last, which are the same

17 Hamiltonian Circuit An Euler circuit for a graph G may not be a Hamiltonian circuit A Hamiltonian circuit may not be an Euler circuit Proved simple criterion for determining whether a graph has an Euler circuit No analogous criterion for determining whether a graph has a Hamiltonian circuit Nor is there an efficient algorithm for finding such an algorithm

18 Hamiltonian Circuit Finding Hamiltonian circuits

19 Traveling Salesman Problem http://en.wikipedia.org/wiki/Traveling_Salesman_Problem

20 Objectives On completion of this topic, student should be able to: a.Explain basic terminology of a graph b.Identify Euler and Hamiltonian cycle c.Represent graphs using adjacency matrices

21 Matrices and Directed Graph Let G be a directed graph with ordered vertices v 1,v 2,…,v n The adjacency matrix of G is the n x n matrix, A =(a ij ) over the set of nonnegative integers such that a ij = the numbers of arrows from v i to v j for all i,j = 1,2,…,n.

22 Examples Adjacency matrix of a graph (Example 11.3.2) Obtaining a directed graph from a matrix (Example 11.3.3)

23 Matrices and (Undirected) Graphs Let G be a (undirected) graph with ordered vertices v 1,v 2,…,v n The adjacency matrix of G is the n x n matrix A =(a ij ) over the set of nonnegative integers such that a ij = the numbers of edges connecting v i and v j for all i,j = 1,2,…,n

24 Examples Finding the adjacency matrix of a graph (Example 11.3.4)

25 Summary Definitions: vertex, edge, loop, parallel edges, complete graph and bipartite Paths & circuits: Euler and Hamiltonian circuits. Finding Euler circuit is easy but not so for Hamiltonian Matrix representation of graphs: adjacency matrix

26 THE END THANK YOU

Download ppt "Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department."

Similar presentations