Skip to main content

A Manim plugin to animate common data structures.

Project description



PyPI Latest Release MIT License Code style: black Downloads

A Manim plugin designed to animate common data structures and algorithms


Manim DSA, short for Manim Data Structures & Algorithms, is a Manim plugin designed to animate common data structures and algorithms. Whether you are an educator looking to enhance your lectures, a student seeking to better understand these concepts, or a content creator making educational videos, Manim DSA provides a robust toolkit to bring abstract concepts to life.

Table of Contents:

Installation

To install Manim DSA, you can use pip:

pip install manim-dsa

If you don't have Manim installed, please refer to the official Manim documentation for installation instructions.

Importing

Simply use the following line of code to import the package:

from manim_dsa import *

Usage

The following is an example Scene where an array, a stack and a graph are created.

from manim import *
from manim_dsa import *

class Example(Scene):
    def construct(self):
        graph = {
            'A': [('C', 11), ('D', 7)],
            'B': [('A', 5),  ('C', 3)],
            'C': [('A', 11), ('B', 3)],
            'D': [('A', 7),  ('C', 4)],
        }
        nodes_and_positions = {
            'A': LEFT * 1.5,
            'B': UP * 2,
            'C': RIGHT * 1.5,
            'D': DOWN * 2,
        }

        mArray = (
            MArray([1, 2, 3], style=ArrayStyle.BLUE)
            .add_indexes()
            .scale(0.9)
            .add_label(Text("Array", font="Cascadia Code"))
            .to_edge(LEFT, 1)
        )

        mStack = (
            MStack([3, 7, 98, 1], style=StackStyle.GREEN)
            .scale(0.8)
            .add_label(Text("Stack", font="Cascadia Code"))
            .move_to(ORIGIN)
        )

        mGraph = (
            MGraph(graph, nodes_and_positions, GraphStyle.PURPLE)
            .add_label(Text("Graph", font="Cascadia Code"))
            .to_edge(RIGHT, 1)
        )

        self.play(Create(mArray))
        self.play(Create(mStack))
        self.play(Create(mGraph))
        self.wait()

The result is as follows:

https://github.com/user-attachments/assets/05307dc9-65d9-4262-ae32-3fb53068c8e4

Documentation

Work in progess.

Help with Manim DSA

If you need help installing or using Manim DSA, or you need to submit a bug report or feature request, please open an issue.

Contributing

Contributions are welcome! Whether it’s reporting a bug, suggesting new features, or submitting pull requests, any help is greatly appreciated.

How to Cite Manim DSA

To demonstrate the value of Manim DSA, we ask that you cite Manim DSA in your work. Currently, the best way to cite Manim DSA is to go to the repository page (if you aren't already) and click the "cite this repository" button on the right sidebar. This will generate a citation in your preferred format, and will also integrate well with citation managers. For guidance on how to properly cite Manim, please refer to the Manim GitHub page.

License

Manim DSA is licensed under the MIT License. You are free to use, modify, and distribute this software as long as you include the original license.

Acknowledgements

  • Manim Community: For creating and maintaining the amazing Manim library.
  • drageelr: For the inspiration behind the array implementation.
  • Verdiana Pasqualini: For the inspiration behind the graph implementation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim_dsa-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

manim_dsa-0.1.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file manim_dsa-0.1.0.tar.gz.

File metadata

  • Download URL: manim_dsa-0.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for manim_dsa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a996bb8cd1b4232a6aa6e28f2d84e26861433e3531540cfdd5f275b05b9fa64b
MD5 8d3ea8301c96d95f209e7f58d9f41ae6
BLAKE2b-256 356faa311bb001d4041f44b293d62f50a3e90c16e11a5fd1da7c59a0fc2ddb08

See more details on using hashes here.

File details

Details for the file manim_dsa-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: manim_dsa-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for manim_dsa-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f1bca774ef2fc0a0bca479092259bd8be9577c4dad42357090af42684ba7fa9
MD5 f5571d89185e3a3ec4c282627e829319
BLAKE2b-256 8fc0369ed7d63bc2ec71b7b668516eaab9db787101b4482b7971f5f5d0dc6927

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page