Hello Viewer! how are you? I hope you are very well. Today I have learned about Graph Data Structure. below I have written whatever I learn today ...
GRAPH
A Graph is a Non-Linear Data Structure that is a collection of Vertices (also called Nodes) and Edges that connect these Vertices.
A Graph is often viewed as a generalization of the Tree Structure, where instead of a purely Parent to Child Relationship between Nodes any kind of Complex relationship between Nodes can exist.
A Tree Structure Node can have any number of children but only one parent, on the other hand, a graph relaxes all such kinds of restrictions. {fig(8) shows a graph with five nodes}
A Node in the graph may represent a CITY and the edges connecting the nodes can represent ROADS.
A Graph can also be used to represent a computer network where the nodes are workstations and the edges are the network connection.
Graphs have so many applications in Computer Science and Mathematics that several algorithms have been written to perform the Standard Graph Operations.
- Such as searching the graph and finding the shortest path between the nodes of a graph.
Note:-
- Unlike trees, graphs do not have any root nodes. rather every node in the graph can be connected with every other node in the graph.
- When two nodes are connected via an edge the two nodes are known as the Neighbour.
- Example: In fig(8) node A has Two Neighbours
Advantage: Best Models real-world situations.
Disadvantage: Some algorithms are slow and very complex.
That's All for Today! I hope You like and understand whatever I have written. If you find any error don't forget to mention it in the comment section or mail me. 💗💗
Note:- I learned this from "Data Structure using C" Book written By Reema Thareja.