![delete plot command datagraph delete plot command datagraph](https://datavizpyr.com/wp-content/uploads/2020/08/facet_wrap_without_box_ggplot2.png)
Every node in a tree will be visited three times in the traversal. A traversing visits every node in a tree. Now we have created a tree, so let’s traverse the tree to print the tree elements. You can insert any number of nodes you want inside a tree depending upon the type of tree you are creating. In the end, we insert two more nodes to the tree i.e 45 and 50, as the children for the node 34. Since it is a binary tree, every node will contain at most two nodes. The root contains the root node of the tree, which has a value of 10, and root.left and root.right using which we will insert the left child with the value 34 and the right child to the root node with the value 89. Whenever you create an object of class Node, the _init_ constructor will be called, and all the variables inside that constructor will be initialized. This Node class will contain 3 variables the first is the left pointing to the left child, the second variable data containing the value for that node, and the right variable pointing to the right child.
![delete plot command datagraph delete plot command datagraph](https://community.visualdatatools.com/datagraph/wp-content/uploads/sites/2/2021/09/image-19-920x369.png)
To create a tree in Python, we first have to start by creating a Node class that will represent a single node.
![delete plot command datagraph delete plot command datagraph](https://communitybucketdatagraph.s3.us-east-2.amazonaws.com/community/datagraph/4348/wrkh0trt5w9j194lbgk4yfz5nltdygh3.png)
#DELETE PLOT COMMAND DATAGRAPH HOW TO#
In this article, let’s first see how to implement a tree from scratch without using any library, and later you will see how to implement a tree with the help of a Python library.