An open API service indexing awesome lists of open source software.

https://github.com/amoshnin/r-recursion.tree.visualizer

⚡️ Tool for visualizing generic recursive function written in JavaScript/Python. Functions are animated using tree structures. It aids identification of function time complexity & call stack depth
https://github.com/amoshnin/r-recursion.tree.visualizer

algorithms recursion recursion-tree recursion-visualizer visualization

Last synced: 7 months ago
JSON representation

⚡️ Tool for visualizing generic recursive function written in JavaScript/Python. Functions are animated using tree structures. It aids identification of function time complexity & call stack depth

Awesome Lists containing this project

README

          

Recursion Tree Visualizer

Tool for visualizing any generic recursive function written in JavaScript or Python.

## Overview

Watch the [demo video](https://youtu.be/VV9sbFn8IoY) on my [YouTube channel](https://www.youtube.com/channel/UC2Q2qLKUSXfPS_mxrtqvixA)

> Recursion is a concept that is best understood through visualization. This visualization tool written in TypeScript (with React and Node JS Express), will allow you to see visualization of different kinds of recursions. For simplicity, I chose to animate recursive functions using trees.
>
> Properties of the recursion tree visualizations are:
>
> - Each node represents a single recursive function call.
> - The height of the recursion tree is the depth of our function call stack (n).
> - The rate of change of the tree’s width represents the time complexity of our function (m):





Image taken from QuanticDev blog post

### Folders structure

- `packages/web`: react user interface.
- `packages/server`: server to execute user-defined code remotely.

## Local development

### Web

In the `packages/web` directory, run:

```bash
# to install all dependencies
$ npm install

# to run the app on localhost
$ npm run start
```

### Server

In the `packages/server` directory, run:

```bash
# to install all dependencies
$ npm install

# to run the app on localhost
$ npm run serve
```

## Acknowledgements

Thanks to [Drawing Presentable Trees](https://llimllib.github.io/pymag-trees/#foot5) and [Improving Walker's Algorithm to Run in Linear Time](http://dirk.jivas.de/papers/buchheim02improving.pdf) articles I implemented Reingold-Tilford's algorithm to position each node of the tree on a 2D plane in an aesthetically pleasing way.

## Compatibility

For a better experience, I recommend using a chromium-based browser like Chrome or Edge.