Tree and Graph both are data structure to store data different format. Due their structure one is called tree and the other one is called graph. We can understand their differences from below table:
Tree | Graph |
Tree is a special form of graph having only one path between any two vertices. | A graph vertices can have more than one path which means a graph can have bi-directional paths between nodes. |
A tree has no loops. | Graph can have loops and circuits. |
There is only one root node and every child have only one parent in tree. | In graph there is no such concept of root node. |
In trees there is parent child relationship between nodes. | In Graph there is no such parent child relationship. |
Trees are less complex than graphs. | Graphs are more complex than trees because of loops/circuits. |
Types of trees are: Binary Tree , Binary Search Tree, AVL tree, Heaps. | Two types of graphs are directed and undirected graph. |
Tree always has n-1 edges. | In graph number of edges depends on the graph. |
There are many other differences but these are some of them.