Giter VIP home page Giter VIP logo

keshavdutt / recursion-tree-visualizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brpapa/recursion-tree-visualizer

0.0 0.0 0.0 1.83 MB

๐ŸŒณ Input the source code of any recursive function in javascript or python and visualize your recursion tree

Home Page: https://recursion.vercel.app

License: MIT License

Shell 0.02% JavaScript 0.85% TypeScript 94.85% CSS 3.15% HTML 0.73% Dockerfile 0.40%

recursion-tree-visualizer's Introduction

Recursion Tree Visualizer

๐Ÿฅ‡ Winner project of the AlgoExpert SWE Project Contest ๐Ÿฅ‡

Overview

Stop drawing recursion trees by hand. Watch the demo video or check out the live project.

Folders structure

  • packages/web: react user interface.
  • packages/lambda: serverless lambda function to execute user-defined code remotely.

Local development

Web

In the packages/web directory, run:

# to install all dependencies
$ npm install

# to run the app on http://localhost:3000
$ npm run start

Lambda

You can use the Amazon Runtime Interface Emulator (RIE), already contained in the docker image, to test the Lambda function.

In the packages/lambda directory, run:

# build your local image
$ docker build --tag rtv .

# create and run a container using AWS RIE as executable to emulate a server for your lambda function
$ docker run --rm -p 8080:8080 rtv

# make a http request to your function, passing event with the -d in body field (escaped json), see examples in requests.http file
$ curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{"body":"{}"}'

Deploy to production

Web

Set your API Gateway endpoint in packages/web/src/config/api.ts.

Ships packages/web on Vercel.

Lambda

The deployment of the Lambda function is automatized by the workflow cd-lambda-function. You will need to complete the following set-up steps to use it:

  1. Create the following AWS resources:

    • Lambda function defined as a container image

    • API Gateway to trigger the lambda function with CORS support

    • ECR repository to store your Docker images

    • IAM user with the proper permissions

  2. Store the IAM user access key in GitHub Actions secrets named AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  3. Change the workflow file github/workflows/cd-lambda-function.yml:

    • Replace the value of the AWS_REGION env with the region of all your AWS resources.

    • Replace the value of the AWS_ECR_REPOSITORY_NAME env with your repository's name.

    • Replace the value of the AWS_LAMBDA_FUNCTION_NAME env with your function's name.

Acknowledgements

Thanks to Drawing Presentable Trees and Improving Walker's Algorithm to Run in Linear Time 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.

Contact me

recursion-tree-visualizer's People

Contributors

brpapa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.