An Easy Way to Create Algorithm Visualizations

Google's DeepDream project has gone viral which allows to visualize the deep learning neural networks. It highlights a need for a generalized algorithm visualization tool, in this post we introduce to you one such effort.

By Daniel Moisset, (

We have released an initial version of, a web application which allows creating and sharing algorithm visualizations. We are going beyond just making a gallery of nice algorithm visualizations, to building the place where people can learn, talk and communicate visually about their code. There are many interesting features (and bug fixes) in our roadmap, but we wanted to release so you can already see what we are on.

Walnut allows users to write programs in Python or Javascript, and make them interact with virtual “worlds” also designed by users. The worlds define shared state, possible actions, what part of the state is visible to each program, etc. It is possible to run single or multiple programs in a world, and then see the results. Then you can define, using a simple declarative DSL, how to represent the result of the execution (the actions that the program did, and both world and program state). You can have many different aspects of a single run with different visualizations.

As an example, let’s take Quicksort. There is a sorting world that defines that the state is a list of numbers, and that a program can see them and do swaps on them, with the goal of getting them in order. You can then add many programs that can play in that world (any swap-based sorting algorithm like Quicksort or Shellsort). You can define scenarios with initial data (to show average and worst cases, or different array sizes). The visualization then can map that information to a display: maybe just moving bars, or the call stack for a recursive algorithm like quicksort, or a plot of the widths of the swaps over time:

Thewalnutio Qs Visualization

If you visit our Explore section you will be able to see as a starting point a few examples that were built by the developer team. But our vision is to have you create your own and share them. Learning algorithms only with code is hard! Crack the nut and let everyone see what’s inside! Join the Walnut revolution!

Bio: Daniel Moisset  @dmoisset is an Entrepreneur, CS teacher, and Software developer.