← AI-aktiviteter 🇸🇪 Svenska

Search Algorithms in Trees

Build your own search trees and follow exactly how BFS, DFS, Greedy Best-First, and A* explore every node.

Choose algorithm

h
cost
Start a search to see the data structure live.

How to build the tree

Colors during the search

Start node Goal node Explored In queue / stack Expanding right now Found path

Tip: During an A* search you can hover over a node to see f(n) = g(n) + h(n).

Search Algorithms in Trees

See how different search algorithms make their way through a tree – and understand the differences between them.

01
Choose a tree – load an example, or build your own (click to create a node, drag between nodes for an edge).
02
Pick an algorithm and search – BFS, DFS, Greedy Best-First, or A*. Use the play/step buttons to follow the search node by node, forward and backward.
03
Compare – run the same tree with different algorithms. Which finds the cheapest path, and which explores the fewest nodes?