Member-only story

DS with JS: Graphs

Darshna Rekha
7 min readDec 16, 2023

This is part of the series DS with JS👇.

Graphs with JavaScript

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.

Vocabulary for Graph

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:

  1. Weighted & unweighted graph
  2. Directed & undirected graph
  3. Cyclic & acyclic graph

--

--

Darshna Rekha
Darshna Rekha

Written by Darshna Rekha

💼 Software Engineer at Cisco Systems, Inc. 🎯 Learn - Code - Repeat 📚 If I am not coding, I am reading

No responses yet