Topological sort หรือ topological ordering ของ directed graph คือ linear ordering ของ vertices ที่สำหรับทุก directed edge UV จาก vertex u ไป vertex v u จะมาก่อน v ใน ordering นี้มีความหมายเฉพาะใน directed graphs มีหลายที่ที่ topological sort นำไปใช้ได้ เช่น ตามสูตรอาหาร มี steps ที่ต้องทำก่อนถึง st