Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
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_inline69997 with the following properties:
  1. The first component, tex2html_wrap_inline69999, is a finite, non-empty set. The elements of tex2html_wrap_inline69999 are called the vertices of G.
  2. The second component, tex2html_wrap_inline70005, is a finite set of ordered pairs of vertices. That is, tex2html_wrap_inline70007. The elements of tex2html_wrap_inline70005 are called the edges of G.

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

eqnarray47709

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.

   figure47713
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_inline70023 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 © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.