Difference between tree and graph

Programmers are regularly inspired to compare trees and graphs. Understand that trees and graphs are both non-linear, non-primitive data structures in the first place.

Both use hubs to address many of the designs used to tackle real problems, but in unexpected ways. Trees utilize different levels of models to address their designs, and diagrams utilize organizational models to represent their structure.

Types of
nonlinear data structures There are two types of nonlinear data structures:

* Tree
* Graph

wood

A tree is a hierarchical model data structure, a collection of a finite number of data elements. Where the data element is a node. In a tree data structure, the main node is the root node, the top node of the structure, and all other nodes are their children, grandchildren, and so on.

There are many types of tree data structures. How the elements are stored in the tree data structure depends on their particular type.

Tree properties

Root node
Angle
parent node
Child node
Leaf node
Subtree level

graph

Graphs are also non-linear data structures. It is a collection of 2 sets. Vertices and edges. Vertices are nodes and edges are a set of elements that connect two vertices.

The data structure of the graph represents that structure according to the network model, which can form a closed loop. There are many types of charts, and how vertices are connected to edges depends on the particular type of chart.

For English translation  - Tree vs Graph

Graph properties

Edge
vertex
cycle

Image 1

Image 2

Image 3

Conclusion

This concludes the explanation of the tree and graph. Also, the difference between a tree and a graph. In summary, the two trees and graphs are a non-direct kind of information structure, but the tree information structure follows a legitimate structure and there is no specific design that follows the graph.

この記事が気に入ったらサポートをしてみませんか?