项目作者: maruks

项目描述 :
高级语言: Common Lisp
项目地址: git://github.com/maruks/daily-coding-topological-sorting-lisp.git


topological

https://en.wikipedia.org/wiki/Topological_sorting

Test

  1. sbcl --non-interactive --eval "(ql:quickload :topological/tests)" --eval "(asdf:test-system :topological)"

Graph

  1. (defparameter *graph-2* '((5 . (11))
  2. (7 . (11 8))
  3. (3 . (8 10))
  4. (11 . (2 9 10))
  5. (8 . (9))))
  6. (top-sort-kahn *graph-2*)
  7. (5 7 3 11 8 10 2 9)
  8. (top-sort-dfs *graph-2*)
  9. (7 3 8 5 11 2 9 10)