How to remove the redundant adjacencies on a DAG?
<p>I'm looking for an algorithm to reduce the redundant adjacencies in a directed acyclic graph. I've made a bit of research and I've found some topics that reference the <strong>transitive reduction</strong>.</p>

<p>After some tests, I've concluded that <strong>it isn't sufficient for me</strong>. It seems that <strong>the transitive reduction only remove the redundant dependencies in the first level:</strong></p>

<p>For example:</p>

<p>If there's an edge <code>a -&gt; b</code> and an edge <code>b -&gt; c</code> then <strong>it removes the edge <code>a -&gt; c</code>.</strong> But if there's an edge <code>a -&gt; b</code>, <code>b -&gt; c</code>, and <code>c -&gt; d</code>, then <strong>it does not remove the edge <code>a -&gt; d</code>.</strong></p>

<p>Therefore I think I need <strong>something like the transitive reduction but for all the levels.</strong></p>

<p>Is there any algorithm to clean my graphs this way?</p>

<p>Thanks a lot!</p>