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=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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Thu, 08 Feb 2007 13:27:26 -0600 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Topological Sort Help 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> Date: Thu, 08 Feb 2007 20:27:25 +0100 Message-ID: <87abzocuw2.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:sxzd7qz6ID71AWnEShrPbY2Xg1w= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 62.235.236.165 X-Trace: sv3-JU9R+dNrypyYyrsSTit8d2ORVZUodXp338ol77QLsOzjW80xE8gvk7fC4bjFHMmBMOB13HsCbm0kUS3!UUjdpdb9qidoZOmUdbiRmW+GqG+ibeqrZNfUeaSGieIXcD3aTHbnNLW1jSkziPTmFr5v7/shgSY= X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:9160 Date: 2007-02-08T20:27:25+01:00 List-Id: 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.