Directed and undirected graphs

In a pair of vertices that make up an edge e, by convention, we call the first vertex the source and the second one the target. The natural interpretation here is that the connection represented by edge e has a direction; it flows from the source to the target. Note that in Figure 1, the graph displayed is undirected; that is, we did not distinguish between the source and target.

Using the exact same definition, we can create a directed version of our graph, as shown in the following image. Note that the graph looks slightly different in the way it is presented, but the connections of vertices and edges remain unchanged:

Figure 2: A directed graph with the same topology as the previous one. In fact, forgetting edge directions would yield the same graph as in Figure 1

Each directed graph naturally has an associated undirected graph, realized by simply forgetting all the edge directions. From a practical perspective, most implementations of graphs inherently build on directed edges and suppress the additional information of direction whenever needed. To give an example, think of the preceding graph as a group of five people connected by the relationship, friendship. We may argue that friendship is a symmetric property in that if you are a friend of mine, I am also a friend of yours. With this interpretation, directionality is not a very useful concept in this example, so we are, in fact, better off to treat this as an undirected graph example. In contrast, if we were to run a social network that allows users to actively send friend requests to other users, a directed graph might be better to encode this information.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset