Lecture 18-19 Graph Tree

Embed Size (px)

DESCRIPTION

sdfds

Citation preview

  • Graph

    1

    Lecture 18-19

  • Euler Graph

    An Euler circuit in a graph G is a simple circuit containing every edge of G.

    A connected graph contains an Eulerian Circuit if and only if every vertex has even degree.

    2

    only if every vertex has even degree.

    An Euler path in G is a simple path containing every edge of G.

    A connected graph contains an Eulerian Path if and only if exactly 2 vertices have odd degree.

  • Euler Graph

    Which of the undirected graphs in Figure 3 have an Euler circuit?

    3

    G1 : ?

  • Euler Graph

    Which of the undirected graphs in Figure 3 have an Euler circuit?

    4

    G1 : Yes, a, e, c, d, e, b, a.G2 : ?

  • Euler Graph

    Which of the undirected graphs in Figure 3 have an Euler circuit?

    5

    G1 : Yes, a, e, c, d, e, b, a.G2 : NoG3 : ?

  • Euler GraphWhich of the undirected graphs in Figure 3 have an Euler circuit?

    6

    G1 : Yes, a, e, c, d, e, b, a.G2 : NoG3 : No

  • Euler Graph

    Which of the undirected graphs in Figure 3 have an Euler path?

    7

    G2 : ?

  • Euler Graph

    Which of the undirected graphs in Figure 3 have an Euler path?

    8

    G2 : NoG3: ?

  • Euler Graph

    Which of the undirected graphs in Figure 3 have an Euler path?

    9

    G2 : NoG3 : Yes: a, c, d, e, b, d, a, b.

  • Hamiltonian Cycles

    An Euler cycle is a cycle in a graph that includes each edge exactly once. Examples: Designing and optimizing routes refuse trucks, snow ploughs, or postmen. In all of these applications, every edge in a graph must be traversed at least once.

    10

    traversed at least once. A Hamiltonian cycle is a cycle in a graph G that

    contains each vertex exactly once except for the starting and ending vertex that appears twice. Examples: travelling sales man who wishes to visit every city and also minimize his route to each city and return to his home city.

  • Hamilton Circuit

    A Hamilton path of a graph or digraph is a path that contains each vertex exactly once, except that the end vertices may be the same.

    A Hamilton circuit (or cycle) is a Hamilton path that is a

    11

    A Hamilton circuit (or cycle) is a Hamilton path that is a cycle.

    Contrast this with an Euler circuit which contains each edge exactly once.

  • Hamilton Path and Circuit

    G has Hamilton path but no Hamilton circuit (or cycle).

    12

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    13

    a c

    d e f g h

    i j

  • Hamilton Circuit Find a Hamilton circuit in the G.

    b

    14

    ba c

    d e f g h

    i j

    Solution: d,a

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    15

    a c

    d e f g h

    i j

    Solution: d,a,e

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    16

    a c

    d e f g h

    i j

    Solution: d,a,e,b

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    17

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    18

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g,c

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    19

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g,c,h

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    20

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g,c,h,j

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    21

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g,c,h,j,f

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    22

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g,c,h,j,f,i

  • ba c

    Hamilton Circuit Find a Hamilton circuit in the G.

    23

    a c

    d e f g h

    i j

    Solution: d,a,e,b,g,c,h,j,f,i,d

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the same graph G.

    24

    a c

    d e f g h

    i j

    Note that while verticies a and b were on previous Hamilton circuit the edge was not.

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    25

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    26

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    27

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    28

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    29

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    30

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    31

    a c

    d e f g h

    i j

  • ba c

    Hamilton Circuit Find another Hamilton circuit in the G.

    32

    a c

    d e f g h

    i j

  • Euler and Hamilton cycles

    A

    B

    C

    D

    F

    33

    G has a Euler cycle but no Hamilton cycle

    B E

  • Hamilton cycles

  • Planar Graphs

    Planar graphs are graphs that can be drawn in the plane without edges having to cross.

    Understanding planar graph is important:

    35

    Any graph representation of maps/ topographical information is planar. graph algorithms often specialized to planar

    graphs (e.g. traveling salesperson) Circuits usually represented by planar

    graphs

  • Planar Graphs-Common Misunderstanding

    Just because a graph is drawn with edges crossing doesnt mean its not planar.

    Q: Why cant we conclude that the following is non-planar?

    36

  • Planar Graphs-Common Misunderstanding

    A: Because it is isomorphic to a graph which is planar:

    37

  • Thank You

    38