graphs lect3

Upload: purijatin

Post on 30-May-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Graphs Lect3

    1/20

    Graphs

    Nitin Upadhyay

    February 27, 2006Bits-Pilani Goa campus

  • 8/14/2019 Graphs Lect3

    2/20

    Discussion

    What is a Graph?

    Applications of Graphs

    Categorization

    Terminology

  • 8/14/2019 Graphs Lect3

    3/20

    Special Graph Structures

    Special cases of undirected graph structures:

    Complete graphs Kn

    Cycles Cn Wheels Wn

    n-Cubes Qn

    Bipartite graphs Complete bipartite graphs Km,n

  • 8/14/2019 Graphs Lect3

    4/20

    Graph Representations

    Adjacency-matrix representation

    Incidence matrix representation

    Edge-set representation

    Adjacency-set representation

    Adjacency List

  • 8/14/2019 Graphs Lect3

    5/20

    Graph Isomorphism

    Formal definition: Simple graphs G1=(V1, E1) and G2=(V2, E2) are

    isomorphicif there is a function f:V1V2 such that

    f is one-to-one .

    f is onto, and

    a,bV1, a and b are adjacent in G1 ifff(a) and

    f(b) are adjacent in G2. fis the renaming function that makes the two

    graphs identical.

  • 8/14/2019 Graphs Lect3

    6/20

    Graph Invariants underIsomorphism

    Necessarybut not sufficientconditions for

    G1=(V1, E1) to be isomorphic to G2=(V2, E2):

    |V1|=|V2|, |E1|=|E2|.

    The number of vertices with degree n is the same

    in both graphs.

    For every proper subgraph gof one graph, there

    is a proper subgraph of the other graph that isisomorphic to g.

  • 8/14/2019 Graphs Lect3

    7/20

  • 8/14/2019 Graphs Lect3

    8/20

    Are These Isomorphic?

    If isomorphic, label the 2nd graph to show the

    isomorphism, else identify difference.

    ab

    c

    d

    e

    * Same # of

    vertices

    * Same # of

    edges* Different

    # of verts ofdegree 2!

    (1 vs 3)Hence, they are NOT isomorphic!

  • 8/14/2019 Graphs Lect3

    9/20

    Subgraphs

    A subgraph of a graph G=(V, E) is a graph

    H=(W, F) where WVand FE.

    G H

  • 8/14/2019 Graphs Lect3

    10/20

    Spanning Subgraph

    A subgraph H= (W, F) of G= (V, E) is called a

    spanning subgraph of G iff:

    W(H)=V(G)

    F(H) E(G)

    G H

  • 8/14/2019 Graphs Lect3

    11/20

    Connectivity

    In an undirected graph, apath of length n

    from u to vis a sequence ofn adjacent edges

    going from vertex u(=x0) to vertex v(=xn).

    A path is a circuitifu=vand n > 0.

    A path pass through the verticesx1,x2,..,xn-1,

    ortraverses the edges e1, e2, , en.

    A path is simple if it does not contain the

    same edge more than once.

  • 8/14/2019 Graphs Lect3

    12/20

    Path Example

    a, d, c, f, e is a simplepath of length 4.

    d, e, c, a is not a pathsince {e, c} is not an edge.

    b, c, f, e, b is a circuit oflength 4 since this pathbegins and ends at b.

    Path a, b, e, d, a, b is nota simple path since itcontains the edge {a, b}

    twice.

    a b c

    d fe

  • 8/14/2019 Graphs Lect3

    13/20

    Counting Paths andAdjacency Matrices

    Let A be the adjacency matrix of graph G.

    The number of paths of length kfrom vi to vj

    is equal to (Ak)i,j. (The notation (M)i,j denotes

    mi,j

    where [mi,j

    ] = M.)

  • 8/14/2019 Graphs Lect3

    14/20

    Counting Paths Example

    a b

    cd

    =

    8008

    0880

    0880

    8008

    4A

    How many paths of

    length 4 are there

    from a to d in the right

    graph?

    The adjacency matrix

    of the graph is

    Hence, the number

    of paths of length

    4 from a to dis the

    (1, 4)th entry ofA4.Since

    There are 8 paths of length

    4 from a to d.

    a b

    cd

    a b

    cd

    =

    0110

    1001

    10010110

    A

    =

    8008

    0880

    0880

    8008

    4A

  • 8/14/2019 Graphs Lect3

    15/20

    Euler & Hamilton Paths

    An Euler circuitin a graph G is a simple

    circuit containing every edge ofG.

    An Euler path in G is a simple path

    containing every edge ofG.

    A Hamilton circuitis a circuit that traverses

    each vertex in G exactly once.

    A Hamilton path is a path that traverses eachvertex in G exactly once.

  • 8/14/2019 Graphs Lect3

    16/20

    Some Useful Theorems

    A connected multigraph has an Euler circuit

    iff each vertex has even degree.

    A connected multigraph has an Euler path

    (but not an Euler circuit) iff it has exactly 2vertices of odd degree.

    If (but not only if) G is connected, simple, has

    n3 vertices, and vdeg(v)n/2, then G hasa Hamilton circuit.s

  • 8/14/2019 Graphs Lect3

    17/20

    Paths in Directed Graphs

    Same as in undirected graphs, but the path

    must go in the direction of the arrows.

  • 8/14/2019 Graphs Lect3

    18/20

    Graph Unions

    The unionG1G2 of two simple graphs

    G1=(V1, E1) and G2=(V2,E2) is the simple

    graph (V1V2, E1E2).

  • 8/14/2019 Graphs Lect3

    19/20

    Graph Union Example

    Find the union of the graphs G1 and G2

    shown below.The vertex set of the union G

    1G

    2is the union of the

    two vertex sets, namely {a, b, c, d, e, f}. The edge

    set of the union is the union of the two edge set.

    a b c

    d e

    a b c

    d f

    a b c

    d fe

    G1 G2 G1 G2

  • 8/14/2019 Graphs Lect3

    20/20

    Questions

    Questions ?