diff --git a/segment_tree/segment_tree.py b/segment_tree/segment_tree.py new file mode 100644 index 0000000..cae721f --- /dev/null +++ b/segment_tree/segment_tree.py @@ -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)