This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 5 mcsftl 2010/9/8 0:40 page 121 #127 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 . b g h i d f c e a 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 between pairs of objects. The objects represent items of interest such as programs, people, cities, or web pages, and we place an edge between a pair of nodes if they are related in a certain way. For example, an edge between a pair of people might indicate that they like (or, in alternate scenarios, that they dont like) each other. An edge between a pair of courses might indicate that one needs to be taken before the other. In this chapter, we will focus our attention on simple graphs where the relation ship denoted by an edge is symmetric. Afterward, in Chapter 6 , we consider the situation where the edge denotes a oneway relationship, for example, where one web page points to the other. 1 5.1 Definitions 5.1.1 Simple Graphs Definition 5.1.1. A simple graph G consists of a nonempty set V , called the ver tices (aka nodes 2 ) of G , and a set E of twoelement subsets of V . The members of E are called the edges of G , and we write G D .V;E/ . 1 Two Stanford students analyzed such a graph to become multibillionaires. So, pay attention to graph theory, and who knows what might happen! 2 We will use the terms vertex and node interchangeably. 122 mcsftl 2010/9/8 0:40 page 122 #128 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 Df a;b;c;d;e;f;g;h;i g E Dff a;b g ; f a;c g ; f b;d g ; f c;d g ; f c;e g ; f e;f g ; f e;g g ; f h;i gg : Note that f a;b g and f b;a g 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 f a;c g 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 j E jD 3 but it does need to have at least one vertex, that is, j V j...
View
Full Document
 Fall '10
 TomLeighton,Dr.MartenvanDijk
 Computer Science, Graph Theory, line graph, Brad best

Click to edit the document details