摘要: 拓扑排序方法如下: (1)从有向图中选择一个没有前驱(即入度为0)的顶点并且输出它. (2)从网中删去该顶点,并且删去从该顶点发出的全部有向边. (3)重复上述两步,直到剩余的网中不再存在没有前驱的顶点为止.这个题是标准的拓扑排序,但需注意这句话:where xxx is the number of relations processed at the time either a sorted sequence is determined or an inconsistency is found, whichever comes first, 也就是说一旦可以确定顺序或者出现环,就要立即输出鄙 阅读全文
posted @ 2011-04-13 18:52 海浪涛天 阅读(222) 评论(0) 推荐(0) 编辑