(BASIC CONCEPTS)
BASIC CONCEPTS
We used decision trees in Unit DT and used them to study decision making. However, we did not look at their structure as trees. In fact, we didn’t even define a tree precisely.
What is a tree? It is a particular type of graph, which brings us to the subject of this unit.
What is a Graph?
There are various types of graphs, each with its own definition. Unfortunately, some people apply the term “graph” rather loosely, so you can’t be sure what type of graph they’re talking about unless you ask them. After you have finished this chapter, we expect you to use the terminology carefully, not loosely. To motivate the various definitions, we’ll begin with some examples.
Example 1 (A computer network) Computers are often linked with one another so that they can interchange information. Given a collection of computers, we would like to describe this linkage in fairly clean terms so that we can answer questions such as “How can we send a message from computer A to computer B using the fewest possible intermediate computers?”
We could do this by making a list that consists of pairs of computers that are connected. Note that these pairs are unordered since, if computer C can communicate with computer D, then the reverse is also true. (There are sometimes exceptions to this, but they are rare and we will assume that our collection of computers does not have such an exception.)
Also, note that we have implicitly assumed that the computers are distinguished from each other: It is insufficient to say that “A PC is connected to a Mac.” We must specify which PC and which Mac. Thus, each computer has a unique identifying label of some sort.
For people who like pictures rather than lists, we can put dots on a piece of paper, one for each computer. We label each dot with a computer’s identifying label and draw a curve connecting two dots if and only if the corresponding computers are connected. Note