Graphs —
No more mental simulation.
Graph algorithms are among the hardest to follow on paper. Which node is visited next in BFS? How does DFS backtrack? What path does Dijkstra's discover? Watching the traversal animate across a live graph makes it all click — run your own Python code and see every step.
What is a Graph?
A graph is a collection of nodes (vertices) connected by edges. Graphs model relationships — social networks, city maps, web pages, dependency trees, and neural networks are all graphs. Graph algorithms like BFS, DFS, and shortest path are essential for technical interviews and real-world systems.
Why visualization helps
Graph problems are staples of DSA interviews. With LearnBug, run your own BFS or DFS code — even if it has bugs — and see exactly which node your traversal visits next. No more mental simulation required. Watch visited states, queues, and stacks update in real time.
Every graph algorithm, animated
BFS Visualization
Breadth-First Search explores level by level. Watch nodes enqueue, visited states update, and see exactly why shortest path in unweighted graphs is BFS.
DFS Visualization
Depth-First Search dives deep before backtracking. Watch the stack build up, visited states track the path, and see how DFS naturally unwinds.
Dijkstra's Shortest Path
Greedily expand the shortest known path. Watch distance values update, the priority queue process nodes, and the optimal path emerge step by step.
Detect Cycle in Graph
DFS-based cycle detection with color states. Watch nodes move from white → grey → black and see exactly when a back edge reveals a cycle.
Topological Sort
Order tasks with dependencies. Watch Kahn's algorithm process nodes by in-degree and see a valid execution order emerge from the DAG.
Number of Islands
Classic grid BFS/DFS. Watch the flood fill expand from each unvisited land cell, marking connected cells visited as each island is counted.
Run your graph code on LearnBug
Paste your BFS or DFS — watch every node visit, every backtrack, every distance update.