Given two positive integers N and K, the task is to construct a simple and connected graph consisting of N vertices with length of each… Read More

# Tag Archives: graph-connectivity

Tarjan’s Algorithm: The Tarjan’s Algorithm is an efficient graph algorithm that is used to find the Strongly Connected Component(SCC) in a directed graph by using… Read More

Given a Tree consisting of N nodes valued in the range [0, N) and an array Queries[] of Q integers consisting of values in the… Read More

Given two integers N and E which denotes the number of nodes and the number of edges of an undirected graph, the task is to… Read More

Given an undirected graph with N vertices and E edges and two vertices (U, V) from the graph, the task is to detect if a… Read More

Given a binary-valued Undirected Graph with V vertices and E edges, the task is to find the maximum decimal equivalent among all the connected components… Read More

A mother vertex in a Graph G = (V, E) is a vertex v such that a path from v can reach all other vertices… Read More

Given an edge list of a graph we have to find the sum of degree of all nodes of a undirected graph. Example Examples: Input… Read More

Given an array arr[] of size N consisting of distinct integers from range [0, N – 1] arranged in a random order. Also given a… Read More

Given a graph with N nodes and M edges. The task is to find the number of ways to select a node from each connected… Read More

Given N vertex where N is even. Initially there is no edge between any of the vertices. You are allowed to perform operation as illustrated… Read More

Given a directed graph, the task is to count the in and out degree of each vertex of the graph.Examples: Input: Output: Vertex In Out… Read More

Given a graph G, the task is to check if it represents a Star Topology. A Star Topology is the one shown in the image… Read More

Given a graph G, the task is to check if it represents a Ring Topology.A Ring Topology is the one shown in the image below: … Read More

Given a graph G, check if it represents a Bus Topology. A Bus Topology is the one shown in the image below: Examples: Input: Output:… Read More