Basic Problems on Graph Data Structure

This section includes some of the basic examples and problems involving Graph Data structure.

Group Connected Components in an UnDirected Graph

In graph theory, a connected component refers to a subset of vertices in a graph where each vertex is connected to every other vertex in the subset, either directly or indirectly. Grouping all connected components in a graph is the process of identifying these subsets and assigning a unique identifier or label to each subset/group of vertices. Read More

Detect Cycles in a Graph

A cycle in a graph is a sequence of edges and vertices where you can start from a specific vertex, follow a continuous path, and return to the same vertex without repeating any edge. In simpler terms, a cycle occurs when you can start at a vertex, traverse a set of edges, and return to the same vertex without retracing any edge. Read More

Find Number of Islands in 2D Map

Finding Number of Islands is a common problem in computer science, where the task is to determine the number of distinct islands in a 2-dimensional grid. In this problem, the grid is represented as a 2D matrix, where each cell can have a value of either 0 or 1. Read More