Your privacy choices

KiwiBee uses optional Google Analytics, Google Ads, and Meta Pixel cookies to understand adult visitors, measure completed sign-ups, and improve campaigns. Essential cookies always stay on. OpenAI’s ChatGPT Ads Pixel also measures page views and completed enquiries after advertising consent, and may use hashed contact details for matching. Privacy policy

Skip to main content

Graph Traversal

About this simulation

This simulation shows how a computer explores a graph. Students choose breadth-first search (BFS) or depth-first search (DFS), pick the start node and set the speed, then watch nodes change color as they are waiting, processed or visited. Readouts show the number visited, the queue or stack size and the order of visits, and a button builds a new random graph. Running both methods from the same start shows that BFS spreads in rings while DFS dives deep. It supports computing lessons on data structures and algorithms.

What students can explore

  • Run BFS from node 1 and read the Visit order readout.
  • Switch Method to DFS with the same Start node and compare the order.
  • Watch the Queue / stack size readout grow and shrink for each method.
  • Change Start node and see how the whole traversal changes.
  • Press Regenerate graph and predict the order before you run it.

Learning objectives

  1. 1Describe how breadth-first and depth-first search explore a graph.
  2. 2Distinguish a queue from a stack and link each to a search method.
  3. 3Predict the visit order for a small graph.
  4. 4Explain why BFS finds routes with the fewest hops.

Questions teachers ask

Is it free to use?

Yes. It is free to use in any modern browser, including whiteboards and tablets, and needs no sign-up.

What is the difference between BFS and DFS?

Breadth-first search uses a queue and visits all nodes one hop away, then two hops, and so on. Depth-first search uses a stack and follows one branch as far as it can before backing up.

What do the colors mean?

Amber nodes are waiting in the queue or stack, white is the node being processed, and visited nodes are shaded from blue for the first to magenta for the last. Bright edges show how each node was reached.

How do I use the graph traversal simulation?

Choose BFS or DFS, set the Start node and Steps/s, and watch the search run. Press Regenerate graph to try a different network.

Embed this simulation

Drop it into your LMS, blog, or class site — free.

<iframe src="https://kiwibee.io/en/simulations/graph-traversal-3d-simulation/embed" title="Graph Traversal | KiwiBee" loading="lazy" allowfullscreen style="width:100%;height:min(70vh,620px);min-height:420px;border:0;border-radius:16px"></iframe>

Continue exploring

Bring interactive science into your classroom

KiwiBee's free teacher workspace brings lesson planning, worksheets, classroom tools, and gradebook together in one place.

Start free and create your first class

or explore the teacher workspace →