From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: New to Ada need help implementing Warshall's algorithm Date: Fri, 23 Sep 2016 07:26:21 +0100 Organization: A noiseless patient Spider Message-ID: References: <955937c4-b9f9-4e21-9d22-98382df2f45f@googlegroups.com> <0e690fe0-7ac8-4843-8792-50ae14729bcc@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="869b0aa788dd1f334f900d4a63ead7ae"; logging-data="27172"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+++3s+C+zWSYvzR5fxGNujWgqGy3RQU50=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:86RYbqXvzFAPsbDFUAdrOsLKWS0= sha1:Q+SxlCxvPnWh1vQgIqxn8Xpp+14= Xref: news.eternal-september.org comp.lang.ada:31857 Date: 2016-09-23T07:26:21+01:00 List-Id: Shark8 writes: > On Wednesday, September 21, 2016 at 4:05:12 PM UTC-6, James Brewer wrote: >> Hello I hope this is right forum for this question. I have been asked >> to write a program that implements Warshall's algorithm using Ada. > In any case, what you could do is use Ada.Containers to handle the > problem: [...] > The rest is left to you. The algorithm, as described in Wikipedia, relies on a 2-D array of Boolean, which sounds a much more straightforward approach. OP is likely to have a lot more trouble dealing with the data input, I'd've thought. I couldn't tell from the description of the input whether that was three examples of order-3 problems or one example of an order-9 problem. Whatever, it'd be simpler if the input was in pairs, one per line, without the => to distract; read the file once to get the dimensions, create an array of the right size (probably on the heap), read again to populate the array, Warshall, bob's your uncle.