Directed Acyclic Graph (DAG)

Context: FIT2004_MOC Β· directed no cycle βž” the graph class on which ” before ” is globally consistent, so it can be sorted

Quick Revision

  • 🎯 Objective: an edge asserts a one-way dependency βž” acyclicity is what makes the dependencies simultaneously satisfiable.
  • ⚠️ Key Constraint: acyclicity is the whole content β€” the instant one cycle exists, no topological order exists and the model is unsatisfiable.

πŸ“ Core

  • Definition βž” a directed Graph containing no directed cycle; edges are ordered pairs , so .
  • What one edge means βž” four readings of the same fact: is a prerequisite of Β· is an ancestor of Β· is a subset of Β· is ordered before . The last is what licenses Topological Sort.
  • Models it fits βž” unit prerequisite chains (FIT1045 βž” FIT1008 βž” FIT2004) Β· project-management task dependencies Β· skill/talent trees Β· the DAG built to solve longest common subsequence.
  • Models it does not βž” anything mutually dependent: JOB ⇄ EXPERIENCE is a -cycle, so no order satisfies both edges β€” this is the exam’s canonical non-DAG.
  • A Tree is a DAG βž” acyclic, with the root the unique vertex having no incoming edge; a DAG generalises it by allowing a vertex several parents.
  • Detecting it βž” run Topological Sort: a run that cannot place all vertices is a cycle certificate, at β€” the same cost as confirming the DAG.
  • Detecting it directly βž” a three-state DFS (unvisited / active / inactive) also decides it in ; a DAG is exactly a digraph with no back edge β€” no edge into a vertex still on the current search path.

⚠️ Common Mistakes

  • πŸ’‘ β€œDirected and no undirected cycle” βž” only directed cycles are forbidden. , , , has an undirected cycle and is still a perfectly good DAG.
  • πŸ’‘ Assuming a unique root βž” a DAG may have many sources (in-degree ) and many sinks (out-degree ); only a Tree is promised one root.

🧠 Active Recall