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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cd5005cccfba0311 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!a75g2000cwd.googlegroups.com!not-for-mail From: "isaac2004" Newsgroups: comp.lang.ada Subject: Re: Topological Sort Help Date: 8 Feb 2007 12:22:01 -0800 Organization: http://groups.google.com Message-ID: <1170966121.850162.326230@a75g2000cwd.googlegroups.com> References: <1170618852.885855.258390@j27g2000cwj.googlegroups.com> <87sldllhpt.fsf@ludovic-brenta.org> <1170707421.136089.281290@l53g2000cwa.googlegroups.com> <87y7ncjq4y.fsf@ludovic-brenta.org> <1170728294.194370.133540@k78g2000cwa.googlegroups.com> <1170752808.678318.252960@l53g2000cwa.googlegroups.com> <1170897552.495666.223180@v33g2000cwv.googlegroups.com> <87ps8ldmrw.fsf@ludovic-brenta.org> <1170958478.093428.155250@j27g2000cwj.googlegroups.com> <87wt2scxt0.fsf@ludovic-brenta.org> <1170959388.358591.91380@s48g2000cws.googlegroups.com> <87ejp0cwf5.fsf@ludovic-brenta.org> <1170962049.091400.130220@v33g2000cwv.googlegroups.com> <87abzocuw2.fsf@ludovic-brenta.org> NNTP-Posting-Host: 140.160.138.147 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1170966136 12940 127.0.0.1 (8 Feb 2007 20:22:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 8 Feb 2007 20:22:16 +0000 (UTC) In-Reply-To: <87abzocuw2.fsf@ludovic-brenta.org> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04324.17; InfoPath.1),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: a75g2000cwd.googlegroups.com; posting-host=140.160.138.147; posting-account=bWy1LAwAAAAtVkasDCH0ykMCBMNd-FcL Xref: g2news2.google.com comp.lang.ada:9161 Date: 2007-02-08T12:22:01-08:00 List-Id: On Feb 8, 11:27 am, Ludovic Brenta wrote: > isaac2004 writes: > > thank you very much i understand i am not asking for code, just help > > with my implementation, V and E are psuedo variables for an edge and > > a vertex of a graph, how the algorithm is supposed to work is by > > parsing through the entire matrix, and checking for any vertex(V) > > that has no sucessors(ie no children) when one is found, it is > > thrown onto a stack that holds the order of the verrtexs with least > > successors. this loop then continues through until all vertex are > > put on the stack, having a topological sort. a conditional is set if > > there are no vertexes with successors (a cycle) and that is the > > algorithm, thanks for all the, now i juts need to set up a looping > > conditional setup that checks if there are no out edges from a > > vertex. does this sound right? > > Yes, that seems about right. Now, consider how the graph is > represented: G (I, J) is True if and only if there is an edge from I > to J. Now, write > > function Has_Successors (V : in Vertices; In_Graph : in Digraph) > return Boolean; > > and use it within Topological_Sort. > > -- > Ludovic Brenta. a call to another function that is a good idea, my question now is, should this function go through the whole matrix or just one cell in a time and the call just be put in a loop