<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intrepid Blog &#187; directed acyclic graph</title>
	<atom:link href="http://blog.affien.com/archives/tag/directed-acyclic-graph/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 23 Jan 2012 08:47:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Online Cycle Detection in Directed Graphs</title>
		<link>http://blog.affien.com/archives/2007/07/02/online-cycle-detection-in-directed-graphs/</link>
		<comments>http://blog.affien.com/archives/2007/07/02/online-cycle-detection-in-directed-graphs/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 21:01:45 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[datastructure]]></category>
		<category><![CDATA[directed acyclic graph]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2007/07/02/online-cycle-detection-in-directed-graphs/</guid>
		<description><![CDATA[A short while ago I came across a quite interesting pro [...]]]></description>
			<content:encoded><![CDATA[<p>A short while ago I came across a quite interesting problem.  Design a datastructure (and algorithms) to maintain a <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph">Directed Acyclic Graph</a>.</p>
<p>There has to be only one operation: adding a link between two given nodes.  This operation must be able to detect and deny any new link that would cause a cycle. For simplicity, nodes are identified by sequential ids starting with 0.</p>
<p>An example:</p>
<p><code>addLink 0, 1 -> True<br />
addLink 1, 2 -> True<br />
addLink 2, 0 -> False # Fails because it would create a cycle</code></p>
<p><code>addLink 0, 1 -> True<br />
addLink 1, 2 -> True<br />
addLink 0, 2 -> True # This isn't a real cycle, so it's perfectly fine</code></p>
<p>It&#8217;s rather trivial to create a <img src='/wp-latexrender/pictures/2575bd27db5c6a8b775972dfd3a49dd5.png' title='\mathcal{O}\left(n+\ell\right)' alt='\mathcal{O}\left(n+\ell\right)' align=absmiddle> (where <img src='/wp-latexrender/pictures/7b8b965ad4bca0e41ab51de7b31363a1.png' title='n' alt='n' align=absmiddle> is the number of nodes and <img src='/wp-latexrender/pictures/ee5e5c003694e7cd5ae404923c665edb.png' title='\ell' alt='\ell' align=absmiddle> the number of links).  I conjecture there exists a <img src='/wp-latexrender/pictures/8d55a5f26c4b0ec9cb6eb8d2609c5c1e.png' title='\mathcal{O}\left(\log n\right)' alt='\mathcal{O}\left(\log n\right)' align=absmiddle> algorithm.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2007/07/02/online-cycle-detection-in-directed-graphs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

