Each edge is an ordered pair of elements from the vertex set. The first entry is the initial vertex of the edge and the second entry is the terminal vertex. Despite the set terminology in this definition, we often think of a graph as a picture, an aid in visualizing a situation. In Chapter 6, we introduced this concept to help understand relations on sets. Although those relations were principally of a mathematical nature, it remains true that when we see a graph, it tells us how the elements of a set are related to one another. We have chosen not to allow a graph with an empty vertex set, the so-called empty graph. There are both advantages and disadvantages to allowing the empty graph, so you may encounter it in other references.
Example9.1.3.A Simple Directed Graph.
Figure 9.1.4 is an example of a simple directed graph. In set terms, this graph is , where and . Note how each edge is labeled either 0 or 1. There are often reasons for labeling even simple graphs. Some labels are to help make a graph easier to discuss; others are more significant. We will discuss the significance of the labels on this graph later.
Henceforth, we will refer to simple undirected graphs as undirected graphs. When drawing an undirected graph, the two-element subsets are drawn as undirected lines or arcs connecting the vertices. It is customary to not allow βself loopsβ in undirected graphs since isnβt a two element subset of vertices.
It may occur to some readers that a graph could be empty, in the sense that it has empty vertex and edge sets. We might refer to this graph as the empty graph. However, there doesnβt seem to be a universally agreed upon definition of an empty graph. In some works, a graph with any number of vertices and no edges is called an empty graph. To avoid this dilemma, we have defined both directed and undirected graphs to have nonempty vertex sets. For convenience, weβve relaxed this rule in our definition of a Binary Tree and allowed for an empty binary tree.
Example9.1.7.An Undirected Graph.
A network of computers can be described easily using a graph. Figure 9.1.8 describes a network of five computers, ,,,, and . An edge between any two vertices indicates that direct two-way communication is possible between the two computers. Note that the edges of this graph are not directed. This is due to the fact that the relation that is being displayed is symmetric (i.e., if can communicate with , then can communicate with ). Although directed edges could be used here, it would simply clutter the graph.
ξ’
Trefoil image
Figure9.1.8.Communications Map
Figure9.1.9.Island Road Map
This undirected graph, in set terms, is and
There are several other situations for which this graph can serve as a model. One of them is to interpret the vertices as cities and the edges as roads, an abstraction of a map such as the one in Figure 9.1.9 . Another interpretation is as an abstraction of the floor plan of a house. See Exercise 9.1.5.11. Vertex represents the outside of the house; all others represent rooms. Two vertices are connected if there is a door between them.
A complete undirected graph on vertices is an undirected graph with the property that each pair of distinct vertices are connected to one another. Such a graph is usually denoted by .
One important point to keep in mind is that if we identify a graph as being a multigraph, it isnβt necessary that there are two or more edges between some of the vertices. It is only just allowed. In other words, every simple graph is a multigraph. This is analogous to how a rectangle is a more general geometric figure than a square, but a square is still considered a rectangle.
Example9.1.12.A Multigraph.
A common occurrence of a multigraph is a road map. The cities and towns on the map can be thought of as vertices, while the roads are the edges. It is not uncommon to have more than one road connecting two cities. In order to give clear travel directions, we name or number roads so that there is no ambiguity. We use the same method to describe the edges of the multigraph in Figure 9.1.13. There is no question what is; however, referring to the edge would be ambiguous.
ξ’
A directed multigraph
Figure9.1.13.A directed multigraph
Example9.1.14.A Labeled Graph.
A flowchart is a common example of a simple graph that requires labels for its vertices and some of its edges. Figure 9.1.15 is one such example that illustrates how many problems are solved.
ξ’
A flow chart - an example of a labeled graph
Figure9.1.15.A flow chart - an example of a labeled graph
At the start of the problem-solving process, we are at the vertex labeled βStartβ and at the end (if we are lucky enough to have solved the problem) we will be at the vertex labeled βEnd.β The sequence of vertices that we pass through as we move from βStartβ to βEndβ is called a path. The βStartβ vertex is called the initial vertex of the path, while the βEndβ is called the final, or terminal, vertex. Suppose that the problem is solved after two attempts; then the path that was taken is StartEnd. An alternate path description would be to list the edges that were used: NoYes. This second method of describing a path has the advantage of being applicable for multigraphs. On the graph in Figure 9.1.13, the vertex list does not clearly describe a path between 1 and 3, but is unambiguous.
If and are two vertices of a graph, then a path between and describes a motion from to along edges of the graph. Vertex is called the initial vertex of the path and is called the terminal vertex. A path between and can always be described by its edge list, the list of edges that were used: , where: (1) the initial vertex of is ; (2) the terminal vertex of is the initial vertex of ,; and (3) the terminal vertex of is . The number of edges in the edge list is the path length. A path on a simple graph can also be described by a vertex list. A path of length will have a list of vertices ,,, where, for , is an edge on the graph. A circuit is a path that terminates at its initial vertex.
Suppose that a path between two vertices has an edge list . A subpath of this graph is any portion of the path described by one or more consecutive edges in the edge list. For example, No is a subpath of NoYes. Any path is its own subpath; however, we call it an improper subpath of itself. All other nonempty subpaths are called proper subpaths.
A path or circuit is simple if it contains no proper subpath that is a circuit. This is the same as saying that a path or circuit is simple if it does not visit any vertex more than once except for the common initial and terminal vertex in the circuit. In the problem-solving method described in Figure 9.1.15, the path that you take is simple only if you reach a solution on the first try.
Intuitively, you could probably predict what the term βsubgraphβ means. A graph contained within a graph, right? But since a graph involves two sets, vertices and edges, does it involve a subset of both of these sets, or just one of them? The answer is it could be either. There are different types of subgraphs. The two that we will define below will meet most of our future needs in discussing the theory of graphs.
Let be a graph of any kind: directed, directed multigraph, or undirected. is a subgraph of if , and only if and the vertices of are in . You create a subgraph of by removing zero or more vertices and all edges that include the removed vertices and then you possibly remove some other edges.
If the only removed edges are those that include the removed vertices, then we say that is an induced subgraph. Finally, is a spanning subgraph of if , or, in other words, no vertices are removed from , only edges.
Example9.1.18.Some subgraphs.
Consider the graph, , in the top left of Figure 9.1.19. The other three graphs in that figure are all subgraphs of . The graph in the top right was created by first removing vertex 5 and all edges connecting it. In addition, we have removed the edge . That removed edge disqualifies the graph from being an induced subgraph. The graphs in the bottom left and right are both spanning subgraphs. The one on the bottom right is a tree, and is referred to as a spanning subtree. Spanning subtrees will be discussed in the chapter on Trees.
One set of subgraphs of any graph is the connected components of a graph. For simplicity, we will define them for undirected graphs. Given a graph , consider the relation βis connected toβ on . We interpret this relation so that each vertex is connected to itself, and any two distinct vertices are related if there is a path along edges of the graph from one to the other. It shouldnβt be too difficult to convince yourself that this is an equivalence relation on .
Given a graph , let be the relation βis connected toβ on . Then the connected components of are the induced subgraphs of each with a vertex set that is an equivalence class with respect to .
Example9.1.21.
If you ignore the duplicate names of vertices in the four graphs of Figure 9.1.19, and consider the whole figure as one large graph, then there are four connected components in that graph. Itβs as simple as that! Itβs harder to describe precisely than to understand the concept.
From the examples weβve seen so far, we can see that although a graph can be defined, in short, as a collection of vertices and edges, an integral part of most graphs is the labeling of the vertices and edges that allows us to interpret the graph as a model for some situation. We continue with a few more examples to illustrate this point.
Example9.1.22.A Graph as a Model for a Set of Strings.
Suppose that you would like to mechanically describe the set of strings of 0βs and 1βs having no consecutive 1βs. One way to visualize a string of this kind is with the graph in Figure 9.1.4. Consider any path starting at vertex . If the label on each graph is considered to be the output to a printer, then the output will have no consecutive 1βs. For example, the path that is described by the vertex list would result in an output of . Conversely, any string with no consecutive 1βs determines a path starting at s.
Example9.1.23.A Tournament Graph.
Suppose that four teams compete in a round-robin sporting event; that is, each team meets every other team once, and each game is played until a winner is determined. If the teams are named A, B, C, and D, we can define the relation on the set of teams by if beat . For one set of results, the graph of might look like Figure 9.1.24.
ξ’
Round-robin tournament graph with four vertices
Figure9.1.24.Round-robin tournament graph with four vertices
A tournament graph is a directed graph with the property that no edge connects a vertex to itself, and between any two vertices there is at most one edge.
A complete (or round-robin) tournament graph is a tournament graph with the property that between any two distinct vertices there is exactly one edge.
A single-elimination tournament graph is a tournament graph with the properties that: (i) one vertex (the champion) has no edge terminating at it and at least one edge initiating from it; (ii) every other vertex is the terminal vertex of exactly one edge; and (iii) there is a path from the champion vertex to every other vertex.
Example9.1.26.Graph of a Single Elimination Tournament.
The major league baseball championship is decided with a single-elimination tournament, where each βgameβ is actually a series of games. From 1969 to 1994, the two divisional champions in the American League (East and West) competed in a series of games. The loser is eliminated and the winner competed against the winner of the National League series (which is decided as in the American League). The tournament graph of the 1983 championship is in Figure 9.1.27
ξ’
A single elimination tournament graph
Figure9.1.27.A single elimination tournament graph
Next, we establish the relation βis isomorphic to,β a form of equality on graphs. The graphs in Figure 9.1.28 obviously share some similarities, such as the number of vertices and the number of edges. It happens that they are even more similar than just that. If the letters ,,, and in the left graph are replaced with the numbers 1,3,4, and 2, respectively, and the vertices are moved around so that they have the same position as the graph on the right, you get the graph on the right.
Two graphs and are isomorphic if there exists a bijection such that if and only if . For multigraphs, we add that the number of edges connecting to must equal the number of edges from to .
Let be a vertex of an undirected graph. The degree of , denoted , is the number of edges that connect to the other vertices in the graph.
If is a vertex of a directed graph, then the outdegree of , denoted , is the number of edges of the graph that initiate at . The indegree of , denoted , is the number of edges that terminate at .
The degree sequence of a simple undirected graph is the non-increasing sequence of its vertex degrees.
Example9.1.32.Some degrees.
Figure9.1.33.An undirected graph
The degrees of vertices 1 through 5 in Figure 9.1.33 are 2, 3, 4, 1, and 2, respectively. The degree sequence of the graph is .
In a tournament graph, is the number of wins for and is the number of losses. In a complete (round-robin) tournament graph with vertices, for each vertex.
A finite nonincreasing sequence of integers is graphic if there exists a simple undirected graph with vertices having the sequence as its degree sequence.
For example, is graphic because the degrees of the graph in Figure 9.1.35 match these numbers. There is no connection between the vertex number and its degree in this graph.
See [26] for more details on what are also referred to as graphical degree sequences, including an algorithm for determining whether or not a sequence is graphic.
The question βOnce you have a graph, what do you do with it?β might come to mind. The following list of common questions and comments about graphs is a partial list that will give you an overview of the remainder of the chapter.
How can a graph be represented as a data structure for use on a computer? We will discuss some common data structures that are used to represent graphs in Section 9.2.
Given two vertices in a graph, does there exist a path between them? The existence of a path between any or all pairs of vertices in a graph will be discussed in Section 9.3. A related question is: How many paths of a certain type or length are there between two vertices?
Is there a path (or circuit) that passes through every vertex (or uses every edge) exactly once? Paths of this kind are called traversals. We will discuss traversals in Section 9.4.
Suppose that a cost is associated with the use of each vertex and/or edge in a path. What is the βcheapestβ path, circuit, or traversal of a given kind? Problems of this kind will be discussed in Section 9.5.
Given the specifications of a graph, or the graph itself, what is the best way to draw the graph? The desire for neatness alone makes this a reasonable question, but there are other motivations. Another goal might be to avoid having edges of the graph cross one another. This is discussed in Section 9.6.
What is the significance of the fact that there is a path connecting vertex with every other vertex in Figure 9.1.8, as it applies to various situations that it models?
Answer.
In Figure 9.1.8, computer can communicate with all other computers. In Figure 9.1.9, there are direct roads to and from city to all other cities.
Draw a graph similar to Figure 9.1.4 that represents the set of strings of 0βs and 1βs containing no more than two consecutive 1βs in any part of the string.
In the NCAA final-four basketball tournament, the East champion plays the West champion, and the champions from the Mideast and Midwest play. The winners of the two games play for the national championship. How many different single-elimination tournament graphs could occur?
Not graphic - if the degree of a graph with seven vertices is 6, it is connected to all other vertices and so there cannot be a vertex with degree zero.
Graphic. One graph with this degree sequence is a cycle of length 6.
Not Graphic. The number of vertices with odd degree is odd, which is impossible.
Graphic. A "wheel graph" with one vertex connected to all other and the others connected to one another in a cycle has this degree sequence.
Graphic. Pairs of vertices connected only to one another.
Not Graphic. With two vertices having maximal degree, 5, every vertex would need to have a degree of 2 or more, so the 1 in this sequence makes it non-graphic.
Draw a plan for the rooms of a house so that Figure 9.1.8 models connectedness of the rooms. That is, is an edge if and only if a door connects rooms and .
How many subgraphs are there of a ,. How many of them are spanning graphs? Assume the vertices are distinguishable. For example, if and we remove one edge from the , we count three possible subgraphs depending on which edge is removed even though all three are isomorphic and would not be different if the vertices were indistinguishable.
You have attempted 1 of 1 activities on this page.