File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ which uses it to compute the order in which to build files.
20
20
21
21
## Solution
22
22
23
+ ### Built-in procedures
24
+
25
+ Chicken and Gauche have a built-in ` topological-sort ` procedure.
26
+
27
+ ### Algorithm T (Knuth)
28
+
29
+ This solution is loosely based on Algorithm T in _ The Art of Computer
30
+ Programming_ section 2.2.3.
31
+
23
32
The graph is represented as a list of lists. The first element of each
24
33
nested list is the label of a graph node, and the rest of the elements
25
34
(if any) are the labels of the nodes that this node depends on.
@@ -29,9 +38,6 @@ Prerequisites:
29
38
* The ` filter ` procedure from SRFI 1.
30
39
* The three-argument version of ` assoc ` from R7RS.
31
40
32
- This solution is loosely based on Algorithm T in _ The Art of Computer
33
- Programming_ (Knuth) section 2.2.3.
34
-
35
41
``` Scheme
36
42
(define (topological-sort nodes eq)
37
43
(define table (map (lambda (n) (cons (car n) 0)) nodes))
@@ -81,10 +87,6 @@ This solution is loosely based on Algorithm T in _The Art of Computer
81
87
82
88
Credit: [ Shiro Kawai] ( https://practical-scheme.net/ )
83
89
84
- ## Built-in procedures
85
-
86
- Chicken and Gauche have a built-in ` topological-sort ` procedure.
87
-
88
90
## Usage
89
91
90
92
### Valid graph
You can’t perform that action at this time.
0 commit comments