MIT6_042JF10_lec05 - 5 mcs-ftl 2010/9/8 0:40 page 121 #127...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 5 mcs-ftl 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 one-way 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 two-element 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 mcs-ftl 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

This note was uploaded on 01/19/2012 for the course CS 6.042J / 1 taught by Professor Tomleighton,dr.martenvandijk during the Fall '10 term at MIT.

Page1 / 69

MIT6_042JF10_lec05 - 5 mcs-ftl 2010/9/8 0:40 page 121 #127...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online