 ## 5 Graph Theory Mit Opencourseware-Free PDF

• Date:01 Jul 2020
• Views:1
• Pages:69
• Size:949.01 KB

Share Pdf : 5 Graph Theory Mit Opencourseware

Report CopyRight/DMCA Form For : 5 Graph Theory Mit Opencourseware

Transcription:

mcs ftl 2010 9 8 0 40 page 122 128,122 Chapter 5 Graph Theory. The vertices correspond to the dots in Figure 5 1 and the edges correspond to the. lines The graph in Figure 5 1 is expressed mathematically as G D V E where. V D fa b c d e f g h i g, E D f fa bg fa cg fb d g fc d g fc eg fe f g fe gg fh ig g. Note that fa bg and fb ag are different descriptions of the same edge since sets. are unordered In this case the graph G D V E has 9 nodes and 8 edges. Definition 5 1 2 Two vertices in a simple graph are said to be adjacent if they. are joined by an edge and an edge is said to be incident to the vertices it joins. The number of edges incident to a vertex v is called the degree of the vertex and. is denoted by deg v equivalently the degree of a vertex is equals the number of. vertices adjacent to it, For example in the simple graph shown in Figure 5 1 vertex a is adjacent to b. and b is adjacent to d and the edge fa cg is incident to vertices a and c Vertex h. has degree 1 d has degree 2 and deg e D 3 It is possible for a vertex to have. degree 0 in which case it is not adjacent to any other vertices A simple graph does. not need to have any edges at all in which case the degree of every vertex is zero. and jEj D 03 but it does need to have at least one vertex that is jV j 1. Note that simple graphs do not have any self loops that is an edge of the form. fa ag since an edge is defined to be a set of two vertices In addition there is at. most one edge between any pair of vertices in a simple graph In other words a. simple graph does not contain multiedges or multiple edges That is because E is a. set Lastly and most importantly simple graphs do not contain directed edges that. is edges of the form a b instead of fa bg, There s no harm in relaxing these conditions and some authors do but we don t. need self loops multiple edges between the same two vertices or graphs with no. vertices and it s simpler not to have them around We will consider graphs with di. rected edges called directed graphs or digraphs at length in Chapter 6 Since we ll. only be considering simple graphs in this chapter we ll just call them graphs. from now on,5 1 2 Some Common Graphs, Some graphs come up so frequently that they have names The complete graph.
on n vertices denoted Kn has an edge between every two vertices for a total of. n n 1 2 edges For example K5 is shown in Figure 5 2. The empty graph has no edges at all For example the empty graph with 5 nodes. is shown in Figure 5 3, 3 The cardinality jEj of the set E is the number of elements in E. mcs ftl 2010 9 8 0 40 page 123 129,5 1 Definitions 123. Figure 5 2 The complete graph on 5 nodes K5,Figure 5 3 The empty graph with 5 nodes. The n node graph containing n 1 edges in sequence is known as the line. graph Ln More formally Ln D V E where,V D fv1 v2 vn g. E D f fv1 v2 g fv2 v3 g fvn 1 vn g g,For example L5 is displayed in Figure 5 4.
If we add the edge fvn v1 g to the line graph Ln we get the graph Cn consisting. of a simple cycle For example C5 is illustrated in Figure 5 5. Figure 5 4 The 5 node line graph L5,mcs ftl 2010 9 8 0 40 page 124 130. 124 Chapter 5 Graph Theory,Figure 5 5 The 5 node cycle graph C5. Figure 5 6 Two graphs that are isomorphic to C4,5 1 3 Isomorphism. Two graphs that look the same might actually be different in a formal sense For. example the two graphs in Figure 5 6 are both simple cycles with 4 vertices but one. graph has vertex set fa b c d g while the other has vertex set f1 2 3 4g Strictly. speaking these graphs are different mathematical objects but this is a frustrating. distinction since the graphs look the same, Fortunately we can neatly capture the idea of looks the same through the no. tion of graph isomorphism, Definition 5 1 3 If G1 D V1 E1 and G2 D V2 E2 are two graphs then we.
say that G1 is isomorphic to G2 iff there exists a bijection4 f W V1 V2 such that. for every pair of vertices u v 2 V1,fu vg 2 E1 iff ff u f v g 2 E2. The function f is called an isomorphism between G1 and G2. In other words two graphs are isomorphic if they are the same up to a relabeling. of their vertices For example here is an isomorphism between vertices in the two. 4A bijection f W V1 V2 is a function that associates every node in V1 with a unique node in V2. and vice versa We will study bijections more deeply in Part III. mcs ftl 2010 9 8 0 40 page 125 131,5 1 Definitions 125. Figure 5 7 Two ways of drawing C5,graphs shown in Figure 5 6. a corresponds to 1 b corresponds to 2,d corresponds to 4 c corresponds to 3. You can check that there is an edge between two vertices in the graph on the left if. and only if there is an edge between the two corresponding vertices in the graph on. Two isomorphic graphs may be drawn very differently For example we have. shown two different ways of drawing C5 in Figure 5 7. Isomorphism preserves the connection properties of a graph abstracting out what. the vertices are called what they are made out of or where they appear in a drawing. of the graph More precisely a property of a graph is said to be preserved under. isomorphism if whenever G has that property every graph isomorphic to G also. has that property For example isomorphic graphs must have the same number of. vertices What s more if f is a graph isomorphism that maps a vertex v of one. graph to the vertex f v of an isomorphic graph then by definition of isomor. phism every vertex adjacent to v in the first graph will be mapped by f to a vertex. adjacent to f v in the isomorphic graph This means that v and f v will have the. same degree So if one graph has a vertex of degree 4 and another does not then. they can t be isomorphic In fact they can t be isomorphic if the number of degree. 4 vertices in each of the graphs is not the same, Looking for preserved properties can make it easy to determine that two graphs.
are not isomorphic or to actually find an isomorphism between them if there is. one In practice it s frequently easy to decide whether two graphs are isomorphic. However no one has yet found a general procedure for determining whether two. graphs are isomorphic that is guaranteed to run in polynomial time5 in jV j. Having such a procedure would be useful For example it would make it easy. to search for a particular molecule in a database given the molecular bonds On. 5 I e in an amount of time that is upper bounded by jV jc where c is a fixed number independent. mcs ftl 2010 9 8 0 40 page 126 132,126 Chapter 5 Graph Theory. the other hand knowing there is no such efficient procedure would also be valu. able secure protocols for encryption and remote authentication can be built on the. hypothesis that graph isomorphism is computationally exhausting. 5 1 4 Subgraphs, Definition 5 1 4 A graph G1 D V1 E1 is said to be a subgraph of a graph. G2 D V2 E2 if V1 V2 and E1 E2, For example the empty graph on n nodes is a subgraph of Ln Ln is a subgraph. of Cn and Cn is a subgraph of Kn Also the graph G D V E where. V D fg h i g and E D f fh i g g, is a subgraph of the graph in Figure 5 1 On the other hand any graph containing an. edge fg hg would not be a subgraph of the graph in Figure 5 1 because the graph. in Figure 5 1 does not contain this edge, Note that since a subgraph is itself a graph the endpoints of any edge in a sub.
graph must also be in the subgraph In other words if G 0 D V 0 E 0 is a subgraph. of some graph G and fvi vj g 2 E 0 then it must be the case that vi 2 V 0 and. 5 1 5 Weighted Graphs, Sometimes we will use edges to denote a connection between a pair of nodes where. the connection has a capacity or weight For example we might be interested in the. capacity of an Internet fiber between a pair of computers the resistance of a wire. between a pair of terminals the tension of a spring connecting a pair of devices in. a dynamical system the tension of a bond between a pair of atoms in a molecule. or the distance of a highway between a pair of cities. In such cases it is useful to represent the system with an edge weighted graph. aka a weighted graph A weighted graph is the same as a simple graph except. that we associate a real number that is the weight with each edge in the graph. Mathematically speaking a weighted graph consists of a graph G D V E and. a weight function w W E R For example Figure 5 8 shows a weighted graph. where the weight of edge fa bg is 5,5 1 6 Adjacency Matrices. There are many ways to represent a graph We have already seen two ways you. can draw it as in Figure 5 8 for example or you can represent it with sets as in. G D V E Another common representation is with an adjacency matrix. mcs ftl 2010 9 8 0 40 page 127 133,5 1 Definitions 127. Figure 5 8 A 4 node weighted graph where the edge fa bg has weight 5. 0 1 0 1 0 5 0 0,B1 0 1 0C B5 0 6 0C,0 1 0 1A 0 6 0 3A. 1 0 1 0 0 0 3 0, Figure 5 9 Examples of adjacency matrices a shows the adjacency matrix for.
the graph in Figure 5 6 a and b shows the adjacency matrix for the weighted. graph in Figure 5 8 In each case we set v1 D a v2 D b v3 D c and v4 D d to. construct the matrix, Definition 5 1 5 Given an n node graph G D V E where V D fv1 v2 vn g. the adjacency matrix for G is the n n matrix AG D faij g where. 1 if fvi vj g 2 E,0 otherwise, If G is a weighted graph with edge weights given by w W E R then the adja. cency matrix for G is AG D faij g where,w fvi vj g if fvi vj g 2 E. 0 otherwise, For example Figure 5 9 displays the adjacency matrices for the graphs shown in. Figures 5 6 a and 5 8 where v1 D a v2 D b v3 D c and v4 D d. mcs ftl 2010 9 8 0 40 page 128 134,128 Chapter 5 Graph Theory.
5 2 Matching Problems, We begin our study of graph theory by considering the scenario where the nodes. in a graph represent people and the edges represent a relationship between pairs. of people such as likes marries and so on Now you may be wondering. what marriage has to do with computer science and with good reason It turns out. that the techniques we will develop apply to much more general scenarios where. instead of matching men to women we need to match packets to paths in a network. applicants to jobs or Internet traffic to web servers And as we will describe later. these techniques are widely used in practice, In our first example we will show how graph theory can be used to debunk an. urban legend about sexual practices in America Yes you read correctly So fasten. your seat belt who knew that math might actually be interesting. 5 2 1 Sex in America, On average who has more opposite gender partners men or women. Sexual demographics have been the subject of many studies In one of the largest. researchers from the University of Chicago interviewed a random sample of 2500. Americans over several years to try to get an answer to this question Their study. published in 1994 and entitled The Social Organization of Sexuality found that on. average men have 74 more opposite gender partners than women. Other studies have found that the disparity is even larger In particular ABC. News claimed that the average man has 20 partners over his lifetime and the aver. age woman has 6 for a percentage disparity of 233 The ABC News study aired. on Primetime Live in 2004 purported to be one of the most scientific ever done. with only a 2 5 margin of error It was called American Sex Survey A peek. between the sheets The promotion for the study is even better. A ground breaking ABC News Primetime Live survey finds a range. of eye popping sexual activities fantasies and attitudes in this country. confirming some conventional wisdom exploding some myths and. venturing where few scientific surveys have gone before. Probably that last part about going where few scientific surveys have gone before. is pretty accurate, Yet again in August 2007 the N Y Times reported on a study by the National. Center for Health Statistics of the U S Government showing that men had seven. partners while women had four,mcs ftl 2010 9 8 0 40 page 129 135.
5 2 Matching Problems 129, Anyway whose numbers do you think are more accurate the University of. Chicago ABC News or the National Center for Health Statistics don t answer. this is a setup question like When did you stop beating your wife Using a little. graph theory we will now explain why none of these findings can be anywhere near. Let s model the question of heterosexual partners in graph theoretic terms To. do this we ll let G be the graph whose vertices V are all the people in America. Then we split V into two separate subsets M which contains all the males and. F which contains all the females 6 We ll put an edge between a male and a female. iff they have been sexual partners A possible subgraph of this graph is illustrated. in Figure 5 10 with males on the left and females on the right. Figure 5 10 A possible subgraph of the sex partners graph. Actually G is a pretty hard graph to figure out let alone draw The graph is. enormous the US population is about 300 million so jV j 300M In the United. States approximately 50 8 of the populatin is female and 49 2 is male and. so jM j 147 6M and jF j 152 4M And we don t even have trustworthy. estimates of how many edges there are let alone exactly which couples are adja. cent But it turns out that we don t need to know any of this to debunk the sex. surveys we just need to figure out the relationship between the average number. 5 Graph Theory Informally a graph is a bunch of dots and lines where the lines connect some pairs of dots An example is shown in Figure 5 1 The dots are called nodes or vertices and the lines are called edges c h i j g e d f b Figure 5 1 An example of a graph with 9 nodes and 8 edges Graphs are ubiquitous in computer science because they provide a handy way to represent a relationship