## Print the lexicographically smallest BFS of the graph starting from 1

Given a connected graph with N vertices and M edges. The task is to print the lexicographically smallest BFS traversal of the graph starting from… Read More »

Given a connected graph with N vertices and M edges. The task is to print the lexicographically smallest BFS traversal of the graph starting from… Read More »

Given an undirected graph G(V, E) with N vertices and M edges. We need to find the minimum number of edges between a given pair… Read More »

In graph theory, edge coloring of a graph is an assignment of “colors” to the edges of the graph so that no two adjacent edges… Read More »

Given a grid with different colors in a different cell, each color represented by a different number. The task is to find out the largest… Read More »

Given a tree, and the cost of a subtree is defined as |S|*AND(S) where |S| is the size of the subtree and AND(S) is bitwise… Read More »

There are n nodes and m bridges in between these nodes. Print the possible path through each node using each edges (if possible), traveling through… Read More »

If the DFS finishing time f[u] > f[v] for two vertices u and v in a directed graph G, and u and v are in… Read More »

Is following statement true/false? A DFS of a directed graph always produces the same number of tree edges, i.e., independent of the order in which… Read More »

Is following statement true/false If a DFS of a directed graph contains a back edge, any other DFS of the same graph will also contain… Read More »

Which of the following condition is sufficient to detect cycle in a directed graph? (A) There is an edge from currently being visited node to… Read More »

Given two vertices in a graph s and t, which of the two traversals (BFS and DFS) can be used to find if there is… Read More »

Make is a utility that automatically builds executable programs and libraries from source code by reading files called makefiles which specify how to derive the… Read More »

Consider the following graph, Among the following sequences: (I) a b e g h f (II) a b f e h g (III) a b… Read More »

Let G be an undirected graph. Consider a depth-first traversal of G, and let T be the resulting depth-first search tree. Let u be a… Read More »

The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is… Read More »