Logo Data Structures and Algorithms with Object-Oriented Design Patterns in C++
next up previous contents index

Directed Graphs

We begin with the definition of a directed graph:

Definition (Directed Graph)  A directed graph  , or digraph , is an ordered pair tex2html_wrap_inline71355 with the following properties:
  1. The first component, tex2html_wrap_inline71357, is a finite, non-empty set. The elements of tex2html_wrap_inline71357 are called the vertices of G.
  2. The second component, tex2html_wrap_inline71363, is a finite set of ordered pairs of vertices. I.e., tex2html_wrap_inline71365. The elements of tex2html_wrap_inline71363 are called the edges of G.

For example, consider the directed graph tex2html_wrap_inline71371 comprised of four vertices and six edges:

eqnarray48371

The graph G can be represented graphically as shown in Figure gif. The vertices are represented by appropriately labeled circles, and the edges are represented by arrows that connect associated vertices.

   figure48375
Figure: A Directed Graph

Notice that because the pairs that represent edges are ordered, the two edges (a,c) and (c,a) are distinct. Furthermore, since tex2html_wrap_inline71381 is a mathematical set, it cannot contain more than one instance of a given edge. And finally, an edge such as (d,d) may connect a node to itself.


next up previous contents index

Bruno Copyright © 1997 by Bruno R. Preiss, P.Eng. All rights reserved.