DSA in Python · Lesson 87 of 132
Graphs Quiz
Test yourself.
Graphs are the most powerful structure in the course. Let's check the key ideas. Pause, answer, then listen.

- The most powerful structure
- Key ideas
- Pause and answer
Question 1
Which search finds the shortest path when every edge costs the same? The answer is breadth first search, because it explores nearest first.
Quick check
Shortest path, equal edges?
Question 2
Why do graph searches need a visited set? The answer is, graphs can have cycles, and without it we'd go round forever.
Quick check
Why keep a visited set?
Question 3
Which algorithm finds shortest routes with different road lengths? The answer is Dijkstra's algorithm, with a heap.
Quick check
Shortest route with weights?
Question 4
Which algorithm puts tasks in an order that respects every rule? The answer is topological sort.
Quick check
Tasks in a valid order?
Summary
Well done. Next, a new section. Problem solving techniques, starting with greedy algorithms.
Key takeaways- BFS for shortest steps
- Visited set for cycles
- Dijkstra for weights
Next up: Greedy Algorithms — the best choice right now