Review and polish topological sorting.
Added graph documentation and cycle-detection documentation.
Minor.