Graph Matrices

download Graph Matrices

of 15

Transcript of Graph Matrices

  • 8/6/2019 Graph Matrices

    1/15

    Matrices

    How do we specify a graph?

    List the vertices and edges

    Specify with computer representation

  • 8/6/2019 Graph Matrices

    2/15

    Computer representation

    adjacency matrix: a |V| x |V| array where each cell i,jcontains theweight of the edge between vi and vj (or 0 for no edge)

    adjacency list: a |V| array where each cell icontains a list of allvertices adjacent to vi

    incidence matrix: a |V| by |E| array where each cell i,jcontains aweight (or a defined constant HEAD for unweighted graphs) if thevertex i is the head of edge jor a constant TAIL if vertex iis the tail of edge j

    c b

    a d4

    2

    6

    108

    a b c d

    a 8 4

    b

    c 6

    d 10 2

    a c 8), 4)

    b

    c b 6)

    d c 2), b 10)

    1 2 3 4 5

    a 8 4

    b t t

    c 6 t t

    d 2 10 t

    adjacency

    matrix adjacencylist incidencematrix

  • 8/6/2019 Graph Matrices

    3/15

    Two graphs are isomorphic if a 1-to-1

    correspondence between their vertex sets exists

    that preserve adjacencies

    Determining to two graphs are isomorphic is NP-complete

    Famous problems: Isomorphism

    a

    b

    c

    d

    e

    1

    2 3

    4 5

  • 8/6/2019 Graph Matrices

    4/15

    Isomorphic GraphsTwo graph G and H are isomorphic if H can be obtained from G by

    relabeling the vertices - that is, if there is a one-to-one

    correspondence between the vertices of G and those of H, such

    that the number of edges joining any pair of vertices in G is equalto the number of edges joining the corresponding pair of vertices in

    H.

    For example, two unlabeled graphs, such as are isomorphic if

    labels can be attached to their vertices so that they become the

    same graph.

  • 8/6/2019 Graph Matrices

    5/15

    Famous problems: Maximal

    cliqueA clique of a graph is its complete subgraph ,

    A clique not contained in any other clique; the largest

    complete subgraph in the graph and then refer to"maximum cliques.

    The problem of finding the size of a clique for a given

    graph is an NP-complete problem.

  • 8/6/2019 Graph Matrices

    6/15

    Famous problems: Maximal

    clique A vertex coverof a graph G can be defined as a set Sof vertices of

    G such that every edge ofG has at least one of member ofSas anendpoint.

    Vertex covers, indicated with red coloring, are shown above for anumber of graphs

    The clique number(G) of a graph G is the number of vertices inthe largest clique in G.

  • 8/6/2019 Graph Matrices

    7/15

    A clique in an undirected graph G = (V, E) is a subset of the vertex set C V, such that for every two vertices inC, there exists an edge connecting the two. This is

    equivalent to saying that the subgraph induced by C iscomplete (in some cases, the term clique may also referto the subgraph).

    A maximal clique is a clique that cannot be extended by

    including one more adjacent vertex, that is, a cliquewhich does not exist exclusively within the vertex set of alarger clique.

    A maximum clique is a clique of the largest possible

    size in a given graph.

    The clique number(G) of a graph G is the number ofvertices in the largest clique in G.

  • 8/6/2019 Graph Matrices

    8/15

    23 1-vertex cliques (its vertices),

    42 2-vertex cliques (its edges),

    19 3-vertex cliques (the light blue triangles), and

    2 4-vertex cliques (dark blue).

    Six of the edges and 11 of the triangles form maximal

    cliques.

    The two dark blue 4-cliques are both maximum and maximal,

    the clique numberof the graph is 4.

  • 8/6/2019 Graph Matrices

    9/15

    Another example

    Determine the no. clique, maximal clique, maximum clique and

    clique number.

  • 8/6/2019 Graph Matrices

    10/15

    Famous problems: Maximal

    clique clique cover: vertex set divided into non-disjoint subsets, each of

    which induces a clique

    clique partition: a disjoint clique cover

    1 2

    4 3

    Maximal cliques: {1,2,3},{1,3,4}

    Vertex cover: {1,3}Clique cover: { {1,2,3}{1,3,4} }

    Clique partition: { {1,2,3}{4} }

  • 8/6/2019 Graph Matrices

    11/15

    Famous problems: Coloring

    vertex coloring: labeling the vertices such thatno edge in E has two end-points with the samelabel

  • 8/6/2019 Graph Matrices

    12/15

    Famous problems: Coloring

    chromatic number: The minimum number of colors whichwith the vertices of a graph G may be colored is calledthe chromatic number, denoted

  • 8/6/2019 Graph Matrices

    13/15

    Famous problems: Bipartite

    graphs Bipartite: any graph whose vertices can

    be partitioned into two distinct sets so that

    every edge has one endpoint in each set.

    How colorable is a bipartite graph?

    Can you come up with an algorithm to

    determine if a graph is bipartite or not?

    K4,4

  • 8/6/2019 Graph Matrices

    14/15

    Petersen graph

    The Petersen graph is most commonly

    drawn as a pentagon with a pentagram

    inside, with five spokes.

    Named after Julius Petersen

    Vertices 10

    Edges 15

    Girth 5

    Chromatic number 3

    Petersen graph

    TheP

    etersen graph is an undirected graph with 10 vertices and 15 edges.

    Girth: The length of the shortest graph cycle in a graph

  • 8/6/2019 Graph Matrices

    15/15

    Solve:

    Exercise: 1.1.2, 1.1.4, 1.1.9, 1.1.11, 1.1.16,

    1.1.18, 1.1.19, 1.1.20, 1.1.24, 1.1.25

    Introduction to Graph Theory

    Second Edition

    Douglas B. West