Tutorials
Courses
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.0K+ articles
Mathematical
5.1K+ articles
Searching
1.0K+ articles
Recursion
591+ articles
Graph
560+ articles
DFS
359+ articles
BFS
228+ articles
graph-connectivity
64+ articles
graph-cycle
58+ articles
Graph Traversals
45 posts
Recent Articles
Popular Articles
Minimum Score in an Undirected Graph
Last Updated: 23 July 2025
Given an undirected graph find all the cycles of length 3 and calculate the minimum score among all these cycles. The score of a cycle is the total number of edges which a...
read more
Graph
DSA
PayPal
Data Structures-Graph
Graph Traversals
Maximizing Safety in a Robber-Infested Grid
Last Updated: 23 July 2025
Given a 2D matrix grid of size n x n, where each cell contains either a robber (denoted by 1), is empty (denoted by 0), or an obstacle (denoted by -1). Your starting posit...
read more
Graph
DSA
Binary Search
BFS
Data Structures-Graph
Graph Traversals
Ascending insertion of elements in graph
Last Updated: 23 July 2025
Given a graph consisting of vertices numbered from 1 to N and having M bidirectional edges connecting vertices u and v. Let P denote an entrance vertex. N elements are num...
read more
Graph
DSA
Dijkstra
Greedy Algorithms
Graph Traversals
Check if traversal from first co-ordinate to all coordinates possible or not
Last Updated: 23 July 2025
Given array A[][2] of size N representing co-ordinates and integer D, the task for this problem is to print a binary string of size N whose i'th character is '1' if it is ...
read more
Graph
DSA
DFS
Graph Traversals
Finding if a node X is present in subtree of another node Y or vice versa for Q queries
Last Updated: 23 July 2025
Given a tree with N nodes and (N-1) edges and source node is at 1st position. There are Q queries, each of the type {pos, X, Y}. Perform the following operation based on t...
read more
Tree
Graph
Searching
DSA
DFS
Graph Traversals
Divide given Graph into Bipartite sets
Last Updated: 23 July 2025
Given a graph G(V, E), divide it into two sets such that no two vertices in a set are connected directly. If not possible print "Not Possible".Examples:Input: V = 7, E = 6...
read more
Recursion
Algo Geek
Algo-Geek 2021
DSA
BFS
Graph Traversals
Smallest set of vertices to visit all nodes of the given Graph
Last Updated: 23 July 2025
Given a directed acyclic graph of N nodes, the task is to find the smallest set of vertices from which the complete graph can be visited.Examples: Input: Graph in the imag...
read more
Graph
Algo Geek
Algo-Geek 2021
DSA
Graph Traversals
Level order traversal by converting N-ary Tree into adjacency list representation with K as root node
Last Updated: 23 July 2025
Given the root node of an N-ary tree and an integer K, the task is to convert the given tree into adjacency list representation and print the level order traversal conside...
read more
Misc
Tree
Mathematical
DSA
tree-traversal
Graph Traversals
tree-level-order
Count all Hamiltonian paths in a given directed graph
Last Updated: 26 July 2025
Given a directed graph of N vertices valued from 0 to N - 1 and array graph[] of size K represents the Adjacency List of the given graph, the task is to count all Hamilton...
read more
DSA
graph-connectivity
Graph Traversals
graph-cycle
Shortest distance between given nodes in a bidirectional weighted graph by removing any K edges
Last Updated: 23 July 2025
Given a positive integer K and a weighted undirected connected graph of N nodes and E edges as an array Edges[] of the type {u, v, W} representing the edges between Node u...
read more
Tree
Graph
Backtracking
Heap
Recursion
C++ Programs
DSA
DFS
Graph Traversals
min-heap
Find if possible to visit every nodes in given Graph exactly once based on given conditions
Last Updated: 23 July 2025
Given a Graph having N+1 nodes with 2*N-1 edges and a boolean array arr[ ], the task is to find if one can visit every nodes exactly once and print any one possible path. ...
read more
DSA
Graph Traversals
Finding Astronauts from different countries
Last Updated: 23 July 2025
Given a positive integer N denoting the number of astronauts(labelled from 0 from (N - 1))and a matrix mat[][] containing the pairs of astronauts that are from the same co...
read more
DSA
DFS
graph-connectivity
Graph Traversals
Print all Hamiltonian Cycles in an Undirected Graph
Last Updated: 23 July 2025
Given an undirected Graph consisting of N nodes in the form of an adjacency matrix graph[][] of size N*N, the task is to print all Hamiltonian cycles possible in the given...
read more
DSA
graph-connectivity
Graph Traversals
graph-cycle
Maximum product of a pair of nodes from largest connected component in a Graph
Last Updated: 23 July 2025
Given an undirected weighted graph G consisting of N vertices and M edges, and two arrays Edges[][2] and Weight[] consisting of M edges of the graph and weights of each ed...
read more
Misc
Graph
Searching
Mathematical
Recursion
DSA
DFS
graph-connectivity
Graph Traversals
Union and Intersection of two Graphs
Last Updated: 23 July 2025
Given two graphs G1 and G2, the task is to find the union and intersection of the two given graphs, i.e. (G1 ∪ G2) and (G1 ∩ G2).Examples:Input: G1 = { ("e1", 1, 2), ("e2"...
read more
Graph
Searching
Mathematical
Hash
DSA
DFS
graph-connectivity
Graph Traversals
1
2
3
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !