Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.

Similar presentations


Presentation on theme: "1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using."— Presentation transcript:

1 1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using adjacency matrices

2 2 Contents Introduction Paths and circuits Matrix representations of graphs

3 3 Introduction to Graphs DEF: A simple graph G = (V,E ) consists of a non-empty set V of vertices (or nodes) and a set E (possibly empty) of edges where each edge is associated with a set consisting of either one or two vertices called its endpoints. Q: For a set V with n elements, how many possible edges there?

4 4 Terminology Loop, parallel edges, isolated, adjacent Loop - an edge connects a vertex to itself Two edges connect the same pair of vertices are said to be parallel. Isolated vertex – unconnected vertex. Two vertices that are connected by an edge are called adjacent. An edge is said to be incident on each of its end points.

5 5 Example of a graph Vertex set = {u 1, u 2, u 3 } Edge set = {e 1, e 2, e 3, e 4 } e 1, e 2, e 3 are incident on u 1 u 2 and u 3 are adjacent to u 1 e 4 is a loop e 2 and e 3 are parallel

6 610 June 2016Graphs and Trees6 Types of Graphs Directed – order counts when discussing edges Undirected (bidirectional) Weighted – each edge has a value associated with it Unweighted

7 710 June 2016Graphs and Trees7 Examples http://richard.jones.name/google-hacks/google-cartography/google-cartography.html

8 810 June 2016Graphs and Trees8 Special Graphs Simple – does not have any loops or parallel edges Complete graphs – there is an edge “between” every possible tuple of vertices Bipartite graph – V can be partitioned into V1 and V2, such that: –(x,y)  E  (x  V1  y  V2)  (x  V2  y  V1) Sub graphs –G1 is a subset of G2 iff  Every vertex in G1 is in G2  Every edge in G1 is in G2 Connected graph – can get from any vertex to another via edges in the graph

9 9 Complete Graphs there is an edge “between” every possible tuple of vertices. |e| = C(n,2) = n. (n-1)/2

10 10 Bipartite graph A graph is bipartite if its vertices can be partitioned into two disjoint subsets U and V such that each edge connects a vertex from U to one from V.

11 11 Complete bipartite A bipartite graph is a complete bipartite graph if every vertex in U is connected to every vertex in V. If U has m elements and V has n, then we denote the resulting complete bipartite graph by Km,n. The illustration shows K3,2

12 1210 June 2016Graphs and Trees12 Degree of Vertex Defined as the number of edges attached (incident) to the vertex. A loop is counted twice.

13 1310 June 2016Graphs and Trees13 Handshake Theorem If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G. Specifically, if the vertices of G are v 1, v 2, …, v n, where n is a nonnegative integer, then: –The total degree of G = d( v 1 )+d( v 2 )+…+d( v n ) = 2  (the number of edges of G )

14 1410 June 2016Graphs and Trees14 Total degree of a graph is even Prove that the total of the degrees of all vertices in a graph is even. Since the total degree equals 2 times of edges, which is an integer, the sum of all degree is even.

15 15 Whether certain graphs exist Draw a graph with the specified properties or show that no such graph exists. (a) A graph with four vertices of degrees 1,1,2, and 3 (b) A graph with four vertices of degrees 1,1,3 and 3 (c) A simple graph with four vertices of degrees 1,1,3 and 3

16 1610 June 2016Graphs and Trees16 Even no. of vertices with odd degree In any graph, there are an even number of vertices with odd degree Is there a graph with ten vertices of degrees 1,1,2,2,2,3,4,4,4, and 6?

17 17 Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using adjacency matrices

18 1810 June 2016Graphs and Trees18 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

19 1910 June 2016Graphs and Trees19 Definitions Terminology - Walk, path, simple path, circuit, simple circuit. Walk from two vertices is a finite alternating sequence of adjacent vertices and edges –Trivial walk from v to v consists of single vertex v 0 e 1 v 1 e 2 …e n v n

20 20 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 v 0 e 1 v 1 e 2 …e n v n where all the e i and v j are distinct. e 1 is represented by {v 0,v 1 }.

21 21 Example - path Path v Simple path w

22 22 Circuit Closed walk – starts and ends at same vertex Circuit – a closed walk without repeated edge Simple circuit – a circuit with no repeated vertex except first and last

23 23 Examples Cuircuit Simple circuit

24 24 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 if, and only if, there is a walk from v to w. The graph G is connected if, and only if, given any two vertices v and w in G, there is a walk from v to w.

25 25 Examples

26 2610 June 2016Graphs and Trees26 Euler Circuits A circuit that contains every vertex and every edge of G. A sequence of adjacent vertices and edges –that starts and ends at the same vertex, –uses every vertex of G at least once, and –uses every edge of G exactly once.

27 2710 June 2016Graphs and Trees27 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.

28 2810 June 2016Graphs and Trees28 If every vertex of nonempty graph has even degree and if graph is connected, then the graph has an Euler circuit.

29 2910 June 2016Graphs and Trees29 Euler Circuit A graph G has an Euler circuit if, and only if, G is connected and every vertex of G has even degree.

30 3010 June 2016Graphs and Trees30 Hamiltonian Path A path in an undirected graph which visits each vertex exactly once.

31 3110 June 2016Graphs and Trees31 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.

32 32 Hamiltonian circuit An Euler circuit for a graph G may not be a Hamiltonian circuit. An Hamiltonian circuit may not be an Euler circuit.

33 3310 June 2016Graphs and Trees33 Hamiltonian 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

34 34 Hamiltonian Circuit Finding Hamiltonian circuits

35 3510 June 2016Graphs and Trees35 Traveling Salesman Problem http://en.wikipedia.org/wiki/Traveling_Sale sman_Problem http://en.wikipedia.org/wiki/Traveling_Sale sman_Problem

36 36 Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using adjacency matrices

37 37 Matrices and Digraph 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.

38 38 Examples Adjacency Matrix of a graph Obtaining a Directed graph from a Matrix.

39 39 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.

40 40 Example Finding the adjacency Matrix of a Graph

41 41 Question ?????

42 42 Exercise Find the adjacency matrices for the following directed graphs.

43 43 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.

44 44 THANK YOU Last updated: 21/9/2009


Download ppt "1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using."

Similar presentations


Ads by Google