Math 3614, Homework 1

Instructions: The following problems are due on Monday 9/23/96 at the beginning of class. You may discuss the problems with other students in the class, but any work you turn in must be your own.

  1. Chapter 6 Supplementary Exercises: 3, 23, 39

  2. Programming Assignment: (See the handout Guidelines for programming assignments for instructions concerning programming assignments).

    Write a program using Warshall's algorithm to generate the transitive closure of a given relation. You may assume that the set on which the relation is defined will have no more than ten elements, and that the elements are the first n positive integers.

    Input should look something like:

    How many elements in the set?
    >> 4
    Using the form "a,b" for the ordered pair (a,b), enter the ordered pairs of the relation. Type -1 to quit.
    >> 1,3
    >> 3,4
    >> 4,2
    >> -1

    Output should look like:

    The original relation (in matrix form) was:
    0 0 1 0
    0 0 0 0
    0 0 0 1
    0 1 0 0
    The transitive closure of this relation is:
    0 1 1 1
    0 0 0 0
    0 1 0 1
    0 1 0 0
    i.e., the set of ordered pairs {(1,2),(1,3),(1,4),(3,2),(3,4),(4,2)}.

    You should run your program on three different data sets: once using the relation in the example above, once using the set {(1,2),(1,3),(4,4),(4,2),(4,3)}, and once using the set {(1,2),(2,3),(3,4),(4,5),(5,1)}.