Graph Traversal Visualizer (BFS & DFS)

Overview

The Graph Traversal Visualizer demonstrates breadth-first search (BFS) and depth-first search (DFS) algorithms on graphs. Create custom graphs by adding nodes and edges, then watch as the algorithms explore the graph step-by-step. The visualization highlights visited nodes, the current frontier, and the order of exploration. Perfect for understanding how these fundamental graph algorithms work and their differences in exploration patterns.

Open in new tab

Tips

  • Start by creating a simple graph with 5-6 nodes to see clear traversal patterns
  • BFS explores level-by-level (uses a queue), perfect for finding shortest paths in unweighted graphs
  • DFS explores depth-first (uses a stack), useful for detecting cycles and topological sorting
  • Try the same graph with both algorithms to see how they differ in exploration order
  • Directed graphs allow one-way edges, undirected graphs have bidirectional connections
  • The traversal tree shows the parent-child relationships discovered during the search
  • Animation speed can be adjusted to slow down and observe each step carefully
  • Try disconnected graphs to see how the algorithms handle unreachable nodes