Member-only story
DS with JS: Graphs
7 min readDec 16, 2023
This is part of the series DS with JS👇.
A graph is a set of values related in a pair-wise fashion. It looks like a network. Graphs, just like linked lists and trees, are made of nodes or vertices. The nodes are then connected, these connections are called edges.
It is yet another non-linear data structure and its usage can be found widely. For example,
- Facebook uses it for the social network
- Amazon uses it for their recommendation engines
- Google map uses it to determine the shortest path between two points (nodes)
Being an important yet complex data structure let us dive into its types.
Types Of Graphs
There three sets of graphs:
- Weighted & unweighted graph
- Directed & undirected graph
- Cyclic & acyclic graph