Phase 3 Exit Criteria & Projects

Graphs are where a lot of people spend months going in circles — solving problems by pattern-matching to remembered solutions rather than building the underlying reasoning. The exit criteria below test whether you’ve built actual understanding. They’re designed to expose the difference between “I’ve seen this type of problem before” and “I can model and solve this cold.”

Don’t rush out of Phase 3. The algorithmic density here — BFS, DFS, Dijkstra, Union-Find, Topological Sort, MST — is high. If you can pass all three criteria, you’re ready for Phase 4. If you can only pass one, stay.


Exit Criteria (Measurable, Not Vibes-Based)

Criterion 1: Algorithm Identification

Given a problem description, identify within 3 minutes which graph algorithm applies — without seeing the constraints.

This is a categorization test, not an implementation test. You don’t solve the problem. You identify the algorithm.

The test: take 10 graph problems you haven’t solved (use LeetCode’s graph tag, sort by acceptance rate descending to get varied difficulty). For each problem, write only: (1) the algorithm you’d use, and (2) a one-sentence justification. Time box: 3 minutes per problem.

Pass condition: correct algorithm for 8/10 problems. Acceptable wrong answers: choosing Dijkstra for a problem solvable with BFS (suboptimal but not wrong). Unacceptable wrong answers: BFS on a weighted graph, topological sort on an undirected graph, Bellman-Ford when there are no negative edges.

The reference table (internalize this):

  • Unweighted shortest path → BFS

  • Weighted shortest path, non-negative → Dijkstra

  • Weighted shortest path, negative edges → Bellman-Ford

  • All-pairs distances → Floyd-Warshall

  • Can all tasks be completed? → Topological sort (cycle detection)

  • What order to take courses? → Topological sort (ordering)

  • Are these nodes connected? / How many components? → Union-Find or BFS/DFS

  • Minimum cost to connect all nodes → MST (Kruskal’s or Prim’s)

  • Grid pathfinding → BFS (shortest) or DFS (existence)


Criterion 2: Dijkstra From Scratch

Implement Dijkstra’s algorithm from scratch in 30 minutes, without any reference, producing a correct solution on LeetCode 743 (Network Delay Time).

This is the implementation fluency test. You should be able to write:

  1. Graph construction from edge list

  2. Priority queue setup with correct comparator

  3. Distance array initialization

  4. Main Dijkstra loop with the stale-entry skip

  5. Correct return value handling

Why this specific problem: LC 743 is clean — directed, positive weights, single source, return max of all distances. It tests the full algorithm without tricky edge cases. If you can’t do this in 30 minutes cold, Dijkstra isn’t internalized yet.

After you pass: time yourself on LC 1514 (Maximum Probability) — same algorithm, different objective function. If you adapt within 10 minutes, you understand the algorithm, not just the implementation.


Criterion 3: Graph Hard Under Time Pressure

Solve a LeetCode Hard graph problem you haven’t seen before in under 60 minutes, independently.

“Independently” means: no hints, no editorial, no similar-problem lookups. Syntax reference is fine.

Suggested pool (pick one you haven’t solved):

  • LC 127 — Word Ladder (BFS on implicit graph)

  • LC 329 — Longest Increasing Path in a Matrix (DFS + memoization on a DAG)

  • LC 269 — Alien Dictionary (Topological sort from inferred constraints)

  • LC 1192 — Critical Connections in a Network (DFS bridges)

  • LC 815 — Bus Routes (BFS with route-level abstraction)

The 60-minute timer starts when you read the problem. After your submission is accepted, read the editorial and write 3 sentences: what the graph model was, which algorithm you used, and what the hardest part was. This post-solve reflection is not optional — it’s the mechanism that consolidates the pattern into memory.


Projects

Three projects. Each builds something that functions, not just notes. The acceptance criteria are intentionally concrete.


Project 1: Graph Algorithm Library

What: implement the following algorithms from scratch in Java (or your chosen language), each in its own function with a clear interface:

  1. BFS — returns shortest distances from a source node

  2. DFS — returns whether a path exists from source to target

  3. Dijkstra — returns shortest distances from a source (non-negative weights)

  4. Union-Find — full class with find(), union(), connected(), componentCount()

  5. Topological Sort (Kahn’s) — returns topological order or empty list if cycle detected

Test cases to include (minimum):

  • BFS: disconnected graph (should handle multiple components)

  • DFS: directed graph with no path from source to target

  • Dijkstra: graph with zero-weight edges, graph with a node unreachable from source

  • Union-Find: add edges one at a time, verify component count updates correctly

  • Topological Sort: valid DAG → correct order; graph with cycle → empty list returned

Acceptance criterion: all 5 algorithms pass their test cases on at least 3 distinct graphs each. Show the output. No LeetCode submission required — this is local code you own and can reference for the rest of your preparation.


Project 2: LeetCode 25-Problem Graph Sprint

Format: 5 easy + 14 medium + 6 hard.

Suggested problem list:

Easy (5): LC 997, LC 1791, LC 1971, LC 1557, LC 463

Medium (14): LC 200, LC 547, LC 207, LC 210, LC 994, LC 542, LC 695, LC 743, LC 1584, LC 417, LC 130, LC 133, LC 1334, LC 787

Hard (6): LC 127, LC 297, LC 269, LC 1192, LC 684, LC 329

Tracking format (for each problem):

  • Problem number and name

  • Time taken (minutes)

  • Independent? (Y / N / Hint)

  • One sentence: the graph model and algorithm used

  • If N or Hint: one sentence on what was missed

Acceptance criterion: 75% independent (≥19 of 25). For any problem requiring a hint or editorial, write the post-mortem sentence. The post-mortems are not punishment — they’re the highest-value learning activity in the sprint.


Project 3: “Model It As a Graph” Document

What: for 5 non-obvious problems, write the complete graph model before writing any code. The document must contain, for each problem:

  1. What are the vertices? (Be specific: not “nodes” — what does each vertex represent in the problem domain?)

  2. What are the edges? (Directed or undirected? What conditions trigger an edge between two vertices?)

  3. What is the algorithm? And why this one and not the others?

  4. What is the start/source? What is the target (if applicable)?

  5. What would make this model wrong? (The constraint check)

The 5 problems:

  1. LC 127 — Word Ladder (implicit graph from string transformations)

  2. LC 207 — Course Schedule (dependency graph)

  3. LC 200 — Number of Islands (grid as implicit graph)

  4. LC 787 — Cheapest Flights Within K Stops (constrained shortest path)

  5. One problem of your choice that surprised you during the sprint

Acceptance criterion: give the document (without code) to a colleague who knows graphs. If they can implement working solutions from your model descriptions alone, you’ve written a good document. If no colleague is available: re-read your own document 5 days later and verify you could implement from it cold without confusion.


Week-by-Week Micro-Schedule (Weeks 18–24)

Phase dates: November 30, 2026 – January 11, 2027

Week 18 (Nov 30 – Dec 6): Graph Foundations + BFS

  • Read 01_graph_fundamentals.md in full; implement BFS and DFS from scratch

  • Complete LC 200 (Number of Islands), LC 547 (Number of Provinces), LC 133 (Clone Graph)

  • Start Project 1: implement BFS and DFS with test cases

  • Deliverable: BFS and DFS pass all test cases in your library

Week 19 (Dec 7–13): DFS Applications + Topological Sort

  • Read 02_bfs_and_dfs.md in depth (three-color DFS, cycle detection)

  • Read 03_topological_sort.md

  • Complete LC 994 (Rotting Oranges), LC 207 (Course Schedule), LC 210 (Course Schedule II)

  • Add Topological Sort to Project 1

  • Deliverable: LC 210 solved with Kahn’s algorithm, returns correct order

Week 20 (Dec 14–20): Dijkstra + Bellman-Ford + Floyd-Warshall

  • Read 04_shortest_paths.md

  • Implement Dijkstra from scratch (no reference) — target: 30 minutes

  • Complete LC 743 (Network Delay Time), LC 787 (Cheapest Flights), LC 1334 (Find the City)

  • Add Dijkstra to Project 1

  • Deliverable: Criterion 2 passed (Dijkstra from scratch in 30 minutes)

Week 21 (Dec 21–27): Union-Find + MST

  • Read 05_union_find.md and 06_minimum_spanning_trees.md

  • Implement Union-Find with both optimizations; run Number of Provinces and Redundant Connection

  • Complete LC 1584 (Min Cost to Connect All Points) with both Kruskal’s and Prim’s

  • Add Union-Find to Project 1

  • Deliverable: Union-Find library passes all test cases; LC 1584 solved two ways

Holiday note: Week 21 coincides with the holiday stretch. The schedule is intentionally lighter — two algorithm files and one project implementation. If you get more time, start the sprint early. Don’t skip Union-Find — it comes up constantly.

Week 22 (Dec 28 – Jan 3, 2027): Hard Problems Sprint

  • Complete 10 hard problems: LC 127, LC 269, LC 1192, LC 684, LC 329, plus 5 from your sprint list

  • Start Project 3: write graph models for Word Ladder and Course Schedule before implementing

  • Deliverable: 10 hard problems attempted; ≥7 solved independently

Week 23 (Jan 4–10): Sprint Completion + Projects

  • Complete remaining sprint problems to reach 25 total

  • Complete Project 3 for all 5 problems

  • Run Criterion 1 (algorithm identification test) on 10 fresh problems

  • Deliverable: sprint at ≥75% independent; Criterion 1 passed

Week 24 (Jan 11): Exit Gate

  • Run exit criteria 1, 2, 3 in sequence

  • If all three pass: advance to Phase 4

  • If Criterion 3 fails: spend one more week on hard graph problems (LC 815, LC 332, LC 399)

  • If Criterion 1 fails: review the algorithm selection table; apply it to 10 more problems


A note on the holiday period (Dec 21 – Jan 3): this is 10 days that overlap Weeks 21-22. If you have more free time than usual, use it on the hard problem sprint. If you have less, protect Week 20 (Dijkstra) and Week 21 (Union-Find) as the non-negotiable algorithmic foundations. The sprint can stretch into Week 24 if needed — the sprint is volume, not prerequisite knowledge.