Lecture 10: Practice Problems

1. Unique Sort?

Does a valid Topological Sort have to be unique?

Show Answer

No.

If two nodes have no dependencies between them, their relative order can be swapped.

Example: Socks and Shirt. You can put Socks first or Shirt first.

2. Hamiltonian Path in DAG

If a topological sort is unique, what does it imply about the DAG?

Show Answer

It has a Hamiltonian Path.

There must be an edge between every consecutive pair of vertices in the sorted order (v1->v2->v3...).