AiTechWorlds
AiTechWorlds
Visualize BFS, DFS, Dijkstra, A*, Prim, Kruskal, and Topological Sort on an interactive draggable graph with synced code.
from collections import deque
def bfs(adj, start):
vis = {start}
q = deque([start])
while q:
u = q.popleft()
for v in adj[u]:
if v not in vis:
vis.add(v); q.append(v)BFS explores a graph level by level using a queue, visiting all neighbors of a node before moving deeper. It finds the shortest path in unweighted graphs.
| Time | O(V + E) |
| Space | O(V) |
| Graph | Undirected, unweighted |
The Graph Algorithm Visualizer on AiTechWorlds animates graph traversal and pathfinding algorithms on an interactive, draggable graph. Graph algorithms power maps, networks, dependency resolution, and social graphs, yet they are among the hardest topics to grasp from pseudocode alone. This tool animates breadth-first search (BFS), depth-first search (DFS), Dijkstra's shortest path, A* pathfinding, Prim's and Kruskal's minimum spanning tree, and topological sort β highlighting visited nodes, frontier queues, and chosen edges as each algorithm runs. Build your own graph by dragging nodes and adding edges, then watch the algorithm explore it with synced code. Everything runs in your browser β AiTechWorlds built this for CS students, interview candidates, and educators.
Build or load a graph
Drag to position nodes and connect edges, or use a preset graph.
Select an algorithm
Choose BFS, DFS, Dijkstra, A*, Prim, Kruskal, or topological sort.
Pick start (and goal)
Set the start node, plus a goal node for pathfinding algorithms.
Run the visualization
Press Run to animate, or step through node-by-node.
Follow the highlights
Watch visited nodes, the frontier, and selected edges update live alongside the code.
100% Private β No Server Required
All processing happens directly in your browser. No data is uploaded, stored, or transmitted to any server.
Last reviewed on June 18, 2026 by the AiTechWorlds Tools Team. All processing runs locally in your browser.
Advertisement