MTree¶
Qualified name: manim\_dsa.m\_graph.m\_tree.MTree
- class MTree(tree, root=None, style=<manim_dsa.constants.MTreeStyle._DefaultStyle object>)[source]¶
Bases:
MGraphManim Tree: a class for visualizing the tree data structure using the Manim animation engine.
- Parameters:
tree (
GraphType) – The tree representation, which can be weighted or unweighted. Can be: -list[list[str]]ordict[str, list[str]]for unweighted tree -list[list[tuple[str, str | int]]]ordict[str, list[tuple[str, str | int]]]for weighted treeroot (str | None, optional) – The root node of the tree. If
None, topological sorting is used to determine the root.style (
MTreeStyle._DefaultStyle, optional) – The style configuration to be applied to the tree. Defaults toMTreeStyle.DEFAULT.
Methods
Applies a hierarchical layout to the nodes of the tree.
Inherited Attributes
animateUsed to animate the application of any method of
self.colordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.