Re: Dynamic cycle Detection
- From: "busygin@xxxxxxxxx" <busygin@xxxxxxxxx>
- Date: 18 Apr 2007 09:50:53 -0700
One obvious thing: if you keep topologocal sorting of your graph and
your new arc goes upwards in it, you don't create a cycle for sure.
Next step of the same idea: rank the vertices such that a) vertices
with no incoming arcs have rank 0; b) vertices of rank k have incoming
arcs only from vertices of ranks 0..k-1. Then, again, if your new arc
is not from a higher rank to a lower rank, there will be no cycle. Of
course, if the new arc goes downwards in your sorting/ranking, there
may be a cycle. You need to update it, and if it's not possible, you
do have a cycle.
Keeping the entire transitive closure doesn't seem to be a good idea
as it's update is more expensive than the marking algortihm to find a
cycle.
--Stas
http://www.busygin.dp.ua
On Apr 18, 11:17 am, aimal.rex...@xxxxxxxxx wrote:
Hello Everyone,
I am working on a problem in which I add edges to a DAG G one by one.
After each addition I need to check if the addition made the digraph
cyclic. I can check this by running DFS, but I want to do it more
efficiently by using the information already available.
Does anyone have any idea on how it can be done efficiently?
Thanks
Aimal
.
- References:
- Dynamic cycle Detection
- From: aimal . rextin
- Dynamic cycle Detection
- Prev by Date: Re: Dynamic cycle Detection
- Next by Date: Re: Languages are regualar
- Previous by thread: Re: Dynamic cycle Detection
- Next by thread: Re: Dynamic cycle Detection
- Index(es):
Relevant Pages
|