Graph Data Structure

--

A Graph is a non-linear data structure consisting of vertices and edges. The vertices are called nodes, and the edges are lines connecting any two nodes in the graph.

Basic components of a graph:

  1. Vertex (Node): Represents a point in the graph.
  2. Edge: Represents a connection between two vertices.

Graph Representation:

  • Adjacency Matrix
Adjacency Matrix
  • Adjacency List
Adjacency List

Basic operations on Graph:

  • Insertion of Nodes/Edges in the graph — Insert a node into the graph.
  • Deletion of Nodes/Edges in the graph — Delete a node from the graph.
  • Searching — Search for an entity in the graph.
  • Traversal — Traversing all the nodes in the graph.

Graph Traversal:

  • Depth-First Search (DFS)
  • Breadth-First Search (BFS)

Shortest Path Algorithms:

  • Dijkstra’s Algorithm
  • Bellman-Ford Algorithm
  • Floyd-Warshall Algorithm

Minimum Spanning Tree (MST):

  • Prim’s Algorithm
  • Kruskal’s Algorithm

Topological Sorting:

  • Kahn’s Algorithm
  • Depth-First Search (DFS) based approach

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Innovative Bytes
Innovative Bytes

Written by Innovative Bytes

AI enthusiast & Flutter developer. Exploring deepfakes, real-time apps, & automation. Blogging about tech innovations, data science, & coding journeys

No responses yet

Write a response