Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Trees & graphs explorer

Build binary search and AVL trees, and run breadth-first, depth-first, shortest paths, spanning trees and topological order on your own graphs.

Binary search tree



  

Graph


  
  

How to use

  1. Tree: type one or more numbers and press Insert, Delete or Search. Search lights up the nodes it visited.
  2. Untick Keep balanced and press Insert 10–100 in order to see a plain tree turn into a chain; tick it again to see rotations keep it short.
  3. Graph: type edges, one per line, then choose a method. The edges it uses are highlighted.

Keyboard

EnterIn the Numbers box: insert
TabMove between boxes and buttons

Tips

  • An in-order walk of a search tree always gives the values sorted.
  • Node names can be words or numbers; A -> B and A, B, 3 also work. A line with one name adds a node with no edges.
  • Topological order (for task lists with “must come before”) only exists when the directed graph has no cycle.
  • Lines starting with # are notes and ignored.

About the explorer

Deleting a node with two children replaces it with the next larger value. AVL balancing keeps the two sides of every node within one level of each other by rotating. Shortest paths use Dijkstra’s method (weights must be 0 or more), the spanning tree uses Kruskal’s method, and the topological order uses Kahn’s method, taking names alphabetically when there is a choice. The tests check every method against separate Python versions on random data.

Everything runs in your browser. Nothing is stored or sent.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product