Published online by Cambridge University Press: 10 November 2016
Extending the Relationships between Records
In a generalization of the linear lists of the previous chapter, we may allow the connection between any two elements, without insisting on some specific order. The resulting structure is known as a graph. This models quite naturally several real life situations, like networks of communicating computers, or road systems connecting the various locations of some neighborhood.We shall, however, see that a graph may be a useful tool for many other applications, some of which seeming a priori completely unconnected to a graph structure.
Mathematically, a graph G is defined as a pair of sets G = (V, E). There is no restriction on the set V, called the vertices of the graph, and its elements are usually denoted, or simply. The set of edges E satisfies and actually describes whether some binary relation exists between certain pairs of vertices.Wemay have or, in which cases the graph is called empty or full, respectively. Note that this refers only to the number of edges, so a graph may be empty and yet have many vertices. The complexities of algorithms involving graphs are often given as a function of the sizes of V and E, for example, but it has become common practice to simplify this notation to when no confusion can arise.
It is customary, and often very helpful as a visual aid, to represent a graph by a drawing in which the vertices appear as dots or circles, and an edge (a, b) as an arrow from the circle corresponding to a to that of b. Figure 3.1 is such a drawing for a graph with and, and will serve as a running example in this chapter. It should be emphasized that this drawing is not the graph G itself, but rather one of its infinitely many possible representations. Indeed, there are almost no restrictions on the layout of the drawing: the circles representing the vertices are generally scattered in any visually appealing way, the edges may be straight lines or arcs or have any other form, they may cross each other, etc.
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.