# Tag Archives: graph-connectivity

## Find if there is a path between two vertices in an undirected graph

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 »

## Maximum decimal equivalent possible among all connected components of a Binary Valued Graph

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… Read More »

## Find a Mother vertex in a Graph using Bit Masking

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 »

## Sum of degrees of all nodes of a undirected graph

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 »

## Check if the array can be sorted using swaps between given indices only

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 »

## Number of ways to select a node from each connected component

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 »

## Minimum operations of the given type required to make a complete graph

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 »

## Finding in and out degrees of all vertices in a graph

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… Read More »

## Check if the given graph represents a Star Topology

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 »

## Check if the given graph represents a Ring Topology

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… Read More »

## Check if the given graph represents a Bus Topology

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 »

## Maximum number of edges among all connected components of an undirected graph

Given integers ‘N’ and ‘K’ where, N is the number of vertices of an undirected graph and ‘K’ denotes the number of edges in the… Read More »

## Number of Walks from source to destination

Given a graph and two vertices src and dest, count the total number of paths from src to dest where the length of the path… Read More »

## All vertex pairs connected with exactly k edges in a graph

Given a directed graph represented as an adjacency matrix and an integer ‘k’, the task is to find all the vertex pairs that are connected… Read More »

## Maximize number of nodes which are not part of any edge in a Graph

Given a graph with n nodes and m edges. Find the maximum possible number of nodes which are not part of any edge (m will… Read More »