55507a7c499d

cl-digraph: Update site.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 14 Mar 2021 21:32:47 -0400
parents d61bb4fbe61d
children 472f83f64e46
branches/tags (none)
files cl-digraph/changelog/index.html cl-digraph/reference/index.html cl-digraph/static/conditions.svg cl-digraph/static/errors.svg cl-digraph/usage/index.html

Changes

--- a/cl-digraph/changelog/index.html	Sun Feb 21 12:18:04 2021 -0500
+++ b/cl-digraph/changelog/index.html	Sun Mar 14 21:32:47 2021 -0400
@@ -15,6 +15,8 @@
 <h1 id="changelog"><a href="">Changelog</a></h1><p>Here's the list of changes in each released version.</p>
 <div class="toc">
 <ul>
+<li><a href="#v140">v1.4.0</a></li>
+<li><a href="#v132">v1.3.2</a></li>
 <li><a href="#v131">v1.3.1</a></li>
 <li><a href="#v130">v1.3.0</a></li>
 <li><a href="#v121">v1.2.1</a></li>
@@ -22,6 +24,11 @@
 <li><a href="#v110">v1.1.0</a></li>
 <li><a href="#v100">v1.0.0</a></li>
 </ul></div>
+<h2 id="v140">v1.4.0</h2>
+<p>Added an explicit <a href="../usage#conditions">condition hierarchy</a>.</p>
+<h2 id="v132">v1.3.2</h2>
+<p><a href="https://github.com/sjl/cl-digraph/issues/4">Fixed a bug</a> where certain kinds of
+cycles were not correctly detected during topological sorting.</p>
 <h2 id="v131">v1.3.1</h2>
 <p><a href="https://github.com/sjl/cl-digraph/pull/3">Fixed a bug</a> for recent SBCL versions
 when creating a digraph without a custom hash function.</p>
--- a/cl-digraph/reference/index.html	Sun Feb 21 12:18:04 2021 -0500
+++ b/cl-digraph/reference/index.html	Sun Mar 14 21:32:47 2021 -0400
@@ -30,6 +30,7 @@
 <li><a href="#degree-in-function">DEGREE-IN (function)</a></li>
 <li><a href="#degree-out-function">DEGREE-OUT (function)</a></li>
 <li><a href="#digraph-class">DIGRAPH (class)</a></li>
+<li><a href="#digraph-error-class">DIGRAPH-ERROR (class)</a></li>
 <li><a href="#edges-function">EDGES (function)</a></li>
 <li><a href="#emptyp-function">EMPTYP (function)</a></li>
 <li><a href="#insert-edge-function">INSERT-EDGE (function)</a></li>
@@ -45,6 +46,9 @@
 <li><a href="#mapc-depth-first-function">MAPC-DEPTH-FIRST (function)</a></li>
 <li><a href="#mapc-edges-function">MAPC-EDGES (function)</a></li>
 <li><a href="#mapc-vertices-function">MAPC-VERTICES (function)</a></li>
+<li><a href="#missing-predecessor-class">MISSING-PREDECESSOR (class)</a></li>
+<li><a href="#missing-successor-class">MISSING-SUCCESSOR (class)</a></li>
+<li><a href="#missing-vertex-class">MISSING-VERTEX (class)</a></li>
 <li><a href="#neighbors-function">NEIGHBORS (function)</a></li>
 <li><a href="#predecessors-function">PREDECESSORS (function)</a></li>
 <li><a href="#reachablep-function">REACHABLEP (function)</a></li>
@@ -54,6 +58,8 @@
 <li><a href="#roots-function">ROOTS (function)</a></li>
 <li><a href="#successors-function">SUCCESSORS (function)</a></li>
 <li><a href="#topological-sort-function">TOPOLOGICAL-SORT (function)</a></li>
+<li><a href="#topological-sort-cycle-class">TOPOLOGICAL-SORT-CYCLE (class)</a></li>
+<li><a href="#vertex-involved-generic-function">VERTEX-INVOLVED (generic function)</a></li>
 <li><a href="#vertices-function">VERTICES (function)</a></li>
 </ul>
 </li>
@@ -117,6 +123,8 @@
 <p>Return the number of successors of <code>vertex</code>.</p>
 <h3 id="digraph-class"><code>DIGRAPH</code> (class)</h3>
 <p>A directed graph.  Use <code>make-digraph</code> to create one.</p>
+<h3 id="digraph-error-class"><code>DIGRAPH-ERROR</code> (class)</h3>
+<p>Base condition for digraph-related errors.</p>
 <h3 id="edges-function"><code>EDGES</code> (function)</h3>
 <div class="codehilite"><pre><span/>(EDGES DIGRAPH)
 </pre></div>
@@ -136,9 +144,12 @@
 
 
 <p>Insert an edge from <code>predecessor</code> to <code>successor</code> if not already present.</p>
-<p>The <code>predecessor</code> and <code>successor</code> vertices must exist in the graph already.</p>
 <p>Returns <code>t</code> if the edge was already in the graph, or <code>nil</code> if it was
   inserted.</p>
+<p>The <code>predecessor</code> and <code>successor</code> vertices must already exist in the graph.
+  If <code>predecessor</code> is not in the graph a <code>missing-predecessor</code> error will be
+  signaled.  Otherwise, if <code>successor</code> is not in the graph, a <code>missing-successor</code>
+  error will be signaled.</p>
 <h3 id="insert-vertex-function"><code>INSERT-VERTEX</code> (function)</h3>
 <div class="codehilite"><pre><span/>(INSERT-VERTEX DIGRAPH VERTEX)
 </pre></div>
@@ -250,6 +261,14 @@
 <p>Call <code>function</code> on each vertex in <code>digraph</code>.</p>
 <p>The order in which the vertices are processed is unspecified.</p>
 <p>Returns <code>nil</code>.</p>
+<h3 id="missing-predecessor-class"><code>MISSING-PREDECESSOR</code> (class)</h3>
+<p>An error signaled when trying to insert an edge whose predecessor is not in the graph.</p>
+<p><code>vertex-involved</code> can be used to retrieve the offending predecessor.</p>
+<h3 id="missing-successor-class"><code>MISSING-SUCCESSOR</code> (class)</h3>
+<p>An error signaled when trying to insert an edge whose successor is not in the graph.</p>
+<p><code>vertex-involved</code> can be used to retrieve the offending successor.</p>
+<h3 id="missing-vertex-class"><code>MISSING-VERTEX</code> (class)</h3>
+<p>Base condition for errors signaled when inserting an edge with a vertex missing.</p>
 <h3 id="neighbors-function"><code>NEIGHBORS</code> (function)</h3>
 <div class="codehilite"><pre><span/>(NEIGHBORS DIGRAPH VERTEX)
 </pre></div>
@@ -318,7 +337,18 @@
   depends on B" and that B must come before A in the resulting list.  Aside
   from this restriction, the order of the resulting list is arbitrary.</p>
 <p>The order in which the vertices are processed is unspecified.</p>
-<p>An error will be signaled if the graph contains a cycle.</p>
+<p>A <code>topological-sort-cycle</code> error will be signaled if the graph contains
+  a cycle.</p>
+<h3 id="topological-sort-cycle-class"><code>TOPOLOGICAL-SORT-CYCLE</code> (class)</h3>
+<p>An error signaled when topologically sorting a graph that contains a cycle.</p>
+<p><code>vertex-involved</code> can be used to retrieve one of the vertices involved in a
+   cycle.  Which vertex in the cycle is chosen is arbitrary.</p>
+<h3 id="vertex-involved-generic-function"><code>VERTEX-INVOLVED</code> (generic function)</h3>
+<div class="codehilite"><pre><span/>(VERTEX-INVOLVED CONDITION)
+</pre></div>
+
+
+<p>Retrieve the vertex involved in the condition.</p>
 <h3 id="vertices-function"><code>VERTICES</code> (function)</h3>
 <div class="codehilite"><pre><span/>(VERTICES DIGRAPH)
 </pre></div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cl-digraph/static/conditions.svg	Sun Mar 14 21:32:47 2021 -0400
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: %3 Pages: 1 -->
+<svg width="606pt" height="188pt"
+ viewBox="0.00 0.00 606.00 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 184)">
+<title>%3</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-184 602,-184 602,4 -4,4"/>
+<!-- 5 -->
+<g id="node1" class="node">
+<title>5</title>
+<polygon fill="none" stroke="#000000" points="255,-108 0,-108 0,-72 255,-72 255,-108"/>
+<text text-anchor="middle" x="127.5" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">TOPOLOGICAL&#45;SORT&#45;CYCLE</text>
+</g>
+<!-- 1 -->
+<g id="node5" class="node">
+<title>1</title>
+<polygon fill="none" stroke="#000000" stroke-dasharray="5,2" points="337.5,-180 155.5,-180 155.5,-144 337.5,-144 337.5,-180"/>
+<text text-anchor="middle" x="246.5" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">DIGRAPH&#45;ERROR</text>
+</g>
+<!-- 5&#45;&gt;1 -->
+<g id="edge1" class="edge">
+<title>5&#45;&gt;1</title>
+<path fill="none" stroke="#000000" d="M157.5287,-108.1686C172.7496,-117.3779 191.4128,-128.6699 207.7083,-138.5294"/>
+<polygon fill="#000000" stroke="#000000" points="206.1132,-141.655 216.4809,-143.8372 209.7369,-135.6659 206.1132,-141.655"/>
+</g>
+<!-- 4 -->
+<g id="node2" class="node">
+<title>4</title>
+<polygon fill="none" stroke="#000000" points="353,-36 142,-36 142,0 353,0 353,-36"/>
+<text text-anchor="middle" x="247.5" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">MISSING&#45;SUCCESSOR</text>
+</g>
+<!-- 2 -->
+<g id="node4" class="node">
+<title>2</title>
+<polygon fill="none" stroke="#000000" stroke-dasharray="5,2" points="460,-108 273,-108 273,-72 460,-72 460,-108"/>
+<text text-anchor="middle" x="366.5" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">MISSING&#45;VERTEX</text>
+</g>
+<!-- 4&#45;&gt;2 -->
+<g id="edge2" class="edge">
+<title>4&#45;&gt;2</title>
+<path fill="none" stroke="#000000" d="M277.5287,-36.1686C292.7496,-45.3779 311.4128,-56.6699 327.7083,-66.5294"/>
+<polygon fill="#000000" stroke="#000000" points="326.1132,-69.655 336.4809,-71.8372 329.7369,-63.6659 326.1132,-69.655"/>
+</g>
+<!-- 3 -->
+<g id="node3" class="node">
+<title>3</title>
+<polygon fill="none" stroke="#000000" points="598,-36 371,-36 371,0 598,0 598,-36"/>
+<text text-anchor="middle" x="484.5" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">MISSING&#45;PREDECESSOR</text>
+</g>
+<!-- 3&#45;&gt;2 -->
+<g id="edge3" class="edge">
+<title>3&#45;&gt;2</title>
+<path fill="none" stroke="#000000" d="M454.7236,-36.1686C439.6307,-45.3779 421.1243,-56.6699 404.9657,-66.5294"/>
+<polygon fill="#000000" stroke="#000000" points="402.9802,-63.6407 396.2669,-71.8372 406.6263,-69.6162 402.9802,-63.6407"/>
+</g>
+<!-- 2&#45;&gt;1 -->
+<g id="edge4" class="edge">
+<title>2&#45;&gt;1</title>
+<path fill="none" stroke="#000000" d="M336.2189,-108.1686C320.8702,-117.3779 302.0502,-128.6699 285.6177,-138.5294"/>
+<polygon fill="#000000" stroke="#000000" points="283.5456,-135.6909 276.7714,-143.8372 287.1471,-141.6934 283.5456,-135.6909"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cl-digraph/static/errors.svg	Sun Mar 14 21:32:47 2021 -0400
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: %3 Pages: 1 -->
+<svg width="606pt" height="188pt"
+ viewBox="0.00 0.00 606.00 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 184)">
+<title>%3</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-184 602,-184 602,4 -4,4"/>
+<!-- 5 -->
+<g id="node1" class="node">
+<title>5</title>
+<polygon fill="none" stroke="#000000" points="255,-108 0,-108 0,-72 255,-72 255,-108"/>
+<text text-anchor="middle" x="127.5" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">TOPOLOGICAL&#45;SORT&#45;CYCLE</text>
+</g>
+<!-- 1 -->
+<g id="node5" class="node">
+<title>1</title>
+<polygon fill="none" stroke="#000000" stroke-dasharray="5,2" points="337.5,-180 155.5,-180 155.5,-144 337.5,-144 337.5,-180"/>
+<text text-anchor="middle" x="246.5" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">DIGRAPH&#45;ERROR</text>
+</g>
+<!-- 5&#45;&gt;1 -->
+<g id="edge1" class="edge">
+<title>5&#45;&gt;1</title>
+<path fill="none" stroke="#000000" d="M157.5287,-108.1686C172.7496,-117.3779 191.4128,-128.6699 207.7083,-138.5294"/>
+<polygon fill="#000000" stroke="#000000" points="206.1132,-141.655 216.4809,-143.8372 209.7369,-135.6659 206.1132,-141.655"/>
+</g>
+<!-- 4 -->
+<g id="node2" class="node">
+<title>4</title>
+<polygon fill="none" stroke="#000000" points="353,-36 142,-36 142,0 353,0 353,-36"/>
+<text text-anchor="middle" x="247.5" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">MISSING&#45;SUCCESSOR</text>
+</g>
+<!-- 2 -->
+<g id="node4" class="node">
+<title>2</title>
+<polygon fill="none" stroke="#000000" stroke-dasharray="5,2" points="460,-108 273,-108 273,-72 460,-72 460,-108"/>
+<text text-anchor="middle" x="366.5" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">MISSING&#45;VERTEX</text>
+</g>
+<!-- 4&#45;&gt;2 -->
+<g id="edge2" class="edge">
+<title>4&#45;&gt;2</title>
+<path fill="none" stroke="#000000" d="M277.5287,-36.1686C292.7496,-45.3779 311.4128,-56.6699 327.7083,-66.5294"/>
+<polygon fill="#000000" stroke="#000000" points="326.1132,-69.655 336.4809,-71.8372 329.7369,-63.6659 326.1132,-69.655"/>
+</g>
+<!-- 3 -->
+<g id="node3" class="node">
+<title>3</title>
+<polygon fill="none" stroke="#000000" points="598,-36 371,-36 371,0 598,0 598,-36"/>
+<text text-anchor="middle" x="484.5" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">MISSING&#45;PREDECESSOR</text>
+</g>
+<!-- 3&#45;&gt;2 -->
+<g id="edge3" class="edge">
+<title>3&#45;&gt;2</title>
+<path fill="none" stroke="#000000" d="M454.7236,-36.1686C439.6307,-45.3779 421.1243,-56.6699 404.9657,-66.5294"/>
+<polygon fill="#000000" stroke="#000000" points="402.9802,-63.6407 396.2669,-71.8372 406.6263,-69.6162 402.9802,-63.6407"/>
+</g>
+<!-- 2&#45;&gt;1 -->
+<g id="edge4" class="edge">
+<title>2&#45;&gt;1</title>
+<path fill="none" stroke="#000000" d="M336.2189,-108.1686C320.8702,-117.3779 302.0502,-128.6699 285.6177,-138.5294"/>
+<polygon fill="#000000" stroke="#000000" points="283.5456,-135.6909 276.7714,-143.8372 287.1471,-141.6934 283.5456,-135.6909"/>
+</g>
+</g>
+</svg>
--- a/cl-digraph/usage/index.html	Sun Feb 21 12:18:04 2021 -0500
+++ b/cl-digraph/usage/index.html	Sun Mar 14 21:32:47 2021 -0400
@@ -34,6 +34,7 @@
 <li><a href="#topological-sorting">Topological Sorting</a></li>
 </ul>
 </li>
+<li><a href="#conditions">Conditions</a></li>
 <li><a href="#drawing">Drawing</a></li>
 </ul></div>
 <h2 id="package">Package</h2>
@@ -43,8 +44,7 @@
 <h2 id="creating-digraphs">Creating Digraphs</h2>
 <p>Digraphs can be created with <code>make-digraph</code>:</p>
 <div class="codehilite"><pre><span/><span class="p">(</span><span class="nv">digraph:make-digraph</span><span class="p">)</span>
-<span class="c1">; =&gt;</span>
-<span class="err">#</span><span class="nv">&lt;DIGRAPH:DIGRAPH</span> <span class="p">()</span> <span class="nv">{1002CFD343}&gt;</span>
+<span class="c1">; =&gt; #&lt;DIGRAPH:DIGRAPH () {1002CFD343}&gt;</span>
 </pre></div>
 
 
@@ -185,10 +185,18 @@
 <span class="c1">; =&gt; ((a . b))</span>
 
 <span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'cats</span> <span class="ss">'dogs</span><span class="p">)</span>
-<span class="c1">; =&gt; Error!</span>
+<span class="c1">; =&gt;</span>
+<span class="c1">; Cannot add edge with predecessor CATS because it is not in the graph</span>
+<span class="c1">;    [Condition of type DIGRAPH::MISSING-PREDECESSOR]</span>
+<span class="c1">;</span>
+<span class="c1">; Restarts:</span>
+<span class="c1">;   R 0. CONTINUE - Retry assertion with new value for DIGRAPH::PREDECESSOR.</span>
+<span class="c1">;   R 1. ABORT    - Exit debugger, returning to top level.</span>
 </pre></div>
 
 
+<p>See the <a href="#conditions">Conditions</a> section for more information about the error
+hierarchy.</p>
 <p>Edges can be removed with <code>remove-edge</code>.  Removing an edge that's not in the
 graph is silently ignored:</p>
 <div class="codehilite"><pre><span/><span class="p">(</span><span class="nb">defparameter</span> <span class="vg">*d*</span>
@@ -335,12 +343,64 @@
 
 <span class="p">(</span><span class="nv">digraph:topological-sort</span> <span class="vg">*d*</span><span class="p">)</span>
 <span class="c1">; =&gt; one of</span>
-<span class="p">(</span><span class="nv">C</span> <span class="nv">B</span> <span class="nv">A</span> <span class="nv">D</span><span class="p">)</span>
-<span class="p">(</span><span class="nv">B</span> <span class="nv">C</span> <span class="nv">A</span> <span class="nv">D</span><span class="p">)</span>
+<span class="c1">; (C B A D)</span>
+<span class="c1">; (B C A D)</span>
+</pre></div>
+
+
+<p>A <code>digraph:topological-sort-cycle</code> will be signaled if the digraph
+contains a cycle:</p>
+<div class="codehilite"><pre><span/><span class="p">(</span><span class="nb">defparameter</span> <span class="vg">*d*</span>
+  <span class="p">(</span><span class="nv">digraph:make-digraph</span> <span class="ss">:initial-vertices</span> <span class="o">'</span><span class="p">(</span><span class="nv">a</span> <span class="nv">b</span> <span class="nv">c</span> <span class="nv">d</span><span class="p">)))</span>
+
+<span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'a</span> <span class="ss">'b</span><span class="p">)</span> <span class="c1">; a depends on b</span>
+<span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'b</span> <span class="ss">'c</span><span class="p">)</span> <span class="c1">; b depends on c</span>
+<span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'c</span> <span class="ss">'a</span><span class="p">)</span> <span class="c1">; c depends on a</span>
+
+<span class="p">(</span><span class="nv">digraph:topological-sort</span> <span class="vg">*d*</span><span class="p">)</span>
+<span class="c1">; =&gt;</span>
+<span class="c1">; Cycle detected during topological sort involving vertex A</span>
+<span class="c1">;     [Condition of type DIGRAPH:TOPOLOGICAL-SORT-CYCLE]</span>
+<span class="c1">;</span>
+<span class="c1">; Restarts:</span>
+<span class="c1">;   R 0. ABORT - Exit debugger, returning to top level.</span>
 </pre></div>
 
 
-<p>An error will be signaled if the digraph contains a cycle.</p>
+<p>See the <a href="#conditions">Conditions</a> section for more information about the error
+hierarchy.</p>
+<h2 id="conditions">Conditions</h2>
+<p>The following condition types are defined by cl-digraph:</p>
+<p><a href="../static/conditions.svg"><img alt="condition type hierarchy" src="../static/conditions.svg"/></a></p>
+<p>Dotted outlines denote abstract types that are never actually instantiated, but
+can be useful for handling whole classes of errors.</p>
+<ul>
+<li><code>digraph-error</code>: abstract type for digraph-related errors.</li>
+<li><code>missing-vertex</code>: abstract type for errors signaled when trying to insert an edge involving a vertex that is not in the graph.</li>
+<li><code>missing-predecessor</code>: error signaled when trying to insert an edge whose predecessor is not in the graph.</li>
+<li><code>missing-successor</code>: error signaled when trying to insert an edge whose successor is not in the graph.</li>
+<li><code>topological-sort-cycle</code>: error signaled when trying to topologically sort a graph involving a cycle.</li>
+</ul>
+<p>For <code>missing-vertex</code> errors of both kinds you can use the <code>vertex-involved</code>
+reader to retrieve the offending vertex from the condition object.</p>
+<p>For <code>topological-sort-cycle</code> errors you can use the <code>vertex-involved</code> reader to
+retrieve one of the vertices involved in a cycle from the condition object.
+<em>Which</em> vertex of the cycle is returned is arbitrary:</p>
+<div class="codehilite"><pre><span/><span class="p">(</span><span class="nb">defparameter</span> <span class="vg">*d*</span>
+  <span class="p">(</span><span class="nv">digraph:make-digraph</span> <span class="ss">:initial-vertices</span> <span class="o">'</span><span class="p">(</span><span class="nv">a</span> <span class="nv">b</span> <span class="nv">c</span> <span class="nv">d</span><span class="p">)))</span>
+
+<span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'a</span> <span class="ss">'b</span><span class="p">)</span> <span class="c1">; a depends on b</span>
+<span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'b</span> <span class="ss">'c</span><span class="p">)</span> <span class="c1">; b depends on c</span>
+<span class="p">(</span><span class="nv">digraph:insert-edge</span> <span class="vg">*d*</span> <span class="ss">'c</span> <span class="ss">'a</span><span class="p">)</span> <span class="c1">; c depends on a</span>
+
+<span class="p">(</span><span class="nb">handler-case</span> <span class="p">(</span><span class="nv">digraph:topological-sort</span> <span class="vg">*d*</span><span class="p">)</span>
+  <span class="p">(</span><span class="nv">digraph:topological-sort-cycle-error</span> <span class="p">(</span><span class="nv">c</span><span class="p">)</span>
+    <span class="p">(</span><span class="nb">list</span> <span class="ss">:cyclic</span> <span class="p">(</span><span class="nv">digraph:vertex-involved</span> <span class="nv">c</span><span class="p">))))</span>
+<span class="c1">; =&gt;</span>
+<span class="c1">; (:CYCLIC A)</span>
+</pre></div>
+
+
 <h2 id="drawing">Drawing</h2>
 <p>If you have <a href="http://www.graphviz.org/">Graphviz</a> installed, you can draw digraph objects to images with
 the <a href="https://github.com/michaelw/cl-dot">cl-dot</a> library by loading the optional <code>cl-digraph.dot</code> system:</p>