29 - R , the task is to Fnd a smallest S such that S + = R...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
greater than n since they will involve repeats (visiting the same node of the graph twice). So R n +1 is already included in R R 2 . . . R n and we need not calculate further as we have found R + . In fact, we often don’t have to go as far as n . In the airline example at the beginning of the section there are 8 cities, but the longest paths without repeats are of length 3 . Thus we compute R R 2 R 3 and Fnd that R 4 R R 2 R 3 , so that we can stop. We may describe our procedure by the following Kenya-like algorithm where := denotes assignment: Input R S := R T := R S := R S while not S T do T := T S S := R S od Output T In the above algorithm, whenever the while loop is entered, then S = R n +1 and T = R R 2 . . . R n for n = 1 , 2 , 3 , . . . . There are many ways of improving the algorithm. A very much more efFcient method is Warshall’s algorithm , described in Discrete Maths 2. It is sometimes useful to ‘reverse’ the process of Fnding the transitive closure. In other words, given a transitive relation
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: R , the task is to Fnd a smallest S such that S + = R . The beneFt is that S is smaller, while in some sense having the same information content as R , since R can be reconstructed from S . In general, there can be many solutions for S . We will return to this problem in the easier setting of partial orders in section 5. 4 Functions You have probably spent a large part of your mathematical education con-sidering mathematical functions in one context or another. In this section, we formalize the notion of mathematical functions as special relations, giv-ing the basic deFnitions, ways of constructing functions and properties for reasoning about functions. You have also been introduced to Haskell func-tions, which are examples of the computable functions. In future courses, you will learn about these computable functions. 30...
View Full Document

This note was uploaded on 01/02/2010 for the course MATH Math2009 taught by Professor Koskesh during the Spring '09 term at SUNY Empire State.

Ask a homework question - tutors are online