1 USING: digraphs kernel sequences tools.test ;
4 : test-digraph ( -- digraph )
6 { { "one" 1 } { "two" 2 } { "three" 3 } { "four" 4 } { "five" 5 } }
7 [ first2 pick add-vertex ] each
8 { { "one" "three" } { "one" "four" } { "two" "three" } { "two" "one" } { "three" "four" } }
9 [ first2 pick add-edge ] each ;
11 [ 5 ] [ test-digraph topological-sort length ] unit-test