# Category Archives: Graph

## Maximal Independent Set in an Undirected Graph

Given an undirected graph defined by the number of vertex V and the edges E[ ], the task is to find Maximal Independent Vertex Set… Read More »

## Print negative weight cycle in a Directed Graph

Given a weighted directed graph consisting of V vertices and E edges. The task is to print the cyclic path whose sum of weight is… Read More »

## Maximal independent set from a given Graph using Backtracking

Given an undirected graph with V vertices and E edges, the task is to print all the independent sets and also find the maximal independent… Read More »

## Find if there is a path between two vertices in a directed graph | Set 2

Given a Directed Graph and two vertices in it, check whether there is a path from the first given vertex to second. Example: Consider the… Read More »

## Print all possible paths in a DAG from vertex whose indegree is 0

Given a Directed Acyclic Graph (DAG), having N vertices and M edges, The task is to print all path starting from vertex whose in-degree is… Read More »

## Check if a graph is Strongly, Unilaterally or Weakly connected

Given an unweighted directed graph G as a path matrix, the task is to find out if the graph is Strongly Connected or Unilaterally Connected… Read More »

## Maximum cost path in an Undirected Graph such that no edge is visited twice in a row

Given an undirected graph having N vertices and M edges and each vertex is associated with a cost and a source vertex S is given.… Read More »

## Shortest path in a complement graph

Given an undirected non-weighted graph G. For a given node start return the shortest path that is the number of edges from start to all… Read More »

## Maximum number of bridges in a path of a given graph

Given an undirected graph, the task is to count the maximum number of Bridges between any two vertices of the given graph. Examples: Input: Graph… Read More »

## Count of prime factors of N to be added at each step to convert N to M

Given two integers N and M, the task is to find out minimum number of operations required to convert N to M. Each operation involves… Read More »

## Minimum nodes to be colored in a Graph such that every node has a colored neighbour

Given a graph G with V nodes and E edges, the task is to colour no more than floor(V/2) nodes such that every node has… Read More »

## Finding shortest path between any two nodes using Floyd Warshall Algorithm

Given a graph and two nodes u and v, the task is to print the shortest path between u and v using the Floyd Warshall… Read More »

## Proof that Clique Decision problem is NP-Complete | Set 2

Prerequisite: NP-Completeness, Clique problem. A clique in a graph is a set of vertices where each vertex shares an edge with every other vertex. Thus,… Read More »

## Count of all cycles without any inner cycle in a given Graph

Given an undirected graph consisting of N vertices numbered [0, N-1] and E edges, the task is to count the number of cycles such that… Read More »

## Isomorphism in N-ary Trees

Given two N-ary trees having M nodes each. Also, given their edges and their roots respectively. The task is to check if they are isomorphic… Read More »