initial segmenttree visual: drawing a binary tree

This commit is contained in:
Bibin Muttappillil 2022-10-14 12:53:31 +02:00
parent 39684289b0
commit 3c5e3e1fbe
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
from manim import *
import networkx as nx
class Tree(Scene):
def construct(self):
vertices = list(range(1, 25))
edges = []
for v in vertices[1:]:
edges.append((v // 2, v))
self.play(Create(Graph(vertices, edges, labels=True, layout="tree", layout_config={"vertex_spacing": (1.0, 1.0)}, root_vertex=1)))
self.wait(2)