* there was an error in cycle path printing... a fix by bahadir.

This commit is contained in:
Faik Uygur
2007-02-28 17:58:31 +00:00
parent 6472bae8f0
commit 66559aaf20
+3 -1
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2005, TUBITAK/UEKAE # Copyright (C) 2005 - 2007, TUBITAK/UEKAE
# #
# This program is free software; you can redistribute it and/or modify it under # This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free # the terms of the GNU General Public License as published by the Free
@@ -124,6 +124,8 @@ class Digraph(object):
while self.p[u]: while self.p[u]:
u = self.p[u] u = self.p[u]
cycle.append(u) cycle.append(u)
if self.has_edge(cycle[0], u):
break
cycle.reverse() cycle.reverse()
raise CycleException(cycle) raise CycleException(cycle)
self.color[u] = 'b' # mark black (completed) self.color[u] = 'b' # mark black (completed)