Skip to content

Commit b6098f5

Browse files
committed
Tweak topological-sort headings
1 parent e1b9006 commit b6098f5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

recipes/topological-sort.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ which uses it to compute the order in which to build files.
2020

2121
## Solution
2222

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+
2332
The graph is represented as a list of lists. The first element of each
2433
nested list is the label of a graph node, and the rest of the elements
2534
(if any) are the labels of the nodes that this node depends on.
@@ -29,9 +38,6 @@ Prerequisites:
2938
* The `filter` procedure from SRFI 1.
3039
* The three-argument version of `assoc` from R7RS.
3140

32-
This solution is loosely based on Algorithm T in _The Art of Computer
33-
Programming_ (Knuth) section 2.2.3.
34-
3541
```Scheme
3642
(define (topological-sort nodes eq)
3743
(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
8187

8288
Credit: [Shiro Kawai](https://practical-scheme.net/)
8389

84-
## Built-in procedures
85-
86-
Chicken and Gauche have a built-in `topological-sort` procedure.
87-
8890
## Usage
8991

9092
### Valid graph

0 commit comments

Comments
 (0)