Graph Algorithm Playground illustration

Graph Algorithm Playground

Graphs are the data structure of connection, and the classic algorithms each explore them with a different personality. In this playground you build a graph by clicking to add nodes and dragging between them to add weighted edges — or start from a random one — then set an algorithm loose: breadth-first search ripples outward level by level, depth-first search dives deep, Dijkstra grows a shortest-path tree in order of distance, and Prim assembles the minimum spanning tree. Every visited node, frontier edge and final tree is animated step by step.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • BFS visits nodes in order of hop count — it finds shortest paths when every edge counts 1.
  • Dijkstra generalises BFS to weighted edges by always expanding the closest unvisited node.
  • Prim’s minimum spanning tree and Dijkstra’s shortest-path tree look similar but optimise different things — compare them on the same graph.
  • Runs 100% in your browser — simulations are computed locally on your device.