CodeRigor

COURSE / REAL PRACTICE

Visual graph traversal in Python

Animate breadth-first and depth-first search on a grid, reconstruct parent paths and export a replayable trace.

Lessons & exercises7 authored lessons3 units
Start with the first lesson.

Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.

What you’ll work toward

Export tested BFS/DFS traversal events and replay them in a step/pause/reset grid visualizer. Explain shortest paths in unweighted graphs, DFS limits, unreachable goals and deterministic neighbor order.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.

A look inside the first lesson

A grid is a graph of legal moves

Python
rows = ["...", ".#.", "..."]
row, col = 0, 0
for dr, dc in [(-1,0),(0,1),(1,0),(0,-1)]:
    nr, nc = row + dr, col + dc
    if 0 <= nr < len(rows) and 0 <= nc < len(rows[0]) and rows[nr][nc] == ".":
        print((nr,nc))

Your lesson sequence

Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.