Tag Archives: Graph

Check if directed graph is connected

Problem Given a directed graph, check if it is connected or not. Sample Input Sample Output YES Explanation Start from 0, go to 1, and then 2, hence all the nodes of the graph are connected. Approach We will use the Depth First Search algorithm to solve this problem. We will traverse the given graph and keep marking… Read More »

What is Graph?

A Graph is a collection of Nodes and Edges, and it is a Non-Linear data structure. It is a mathematical concept in which every node shows a relation with another node through edges. It contains a finite number of vertices(nodes) and each node is connected with another node through an edge.

Types of Data Structure

In programming, we use so many types of data structures to provide a proper structure to our data. A data structure is basically used to collect and organize the data on which we are going to perform the operations. For example, we all know what is an array, it is one of the most-used data structures. We use… Read More »