# Category Archives: Graph

## Shortest path with exactly k edges in a directed and weighted graph

Given a directed and two vertices ‘u’ and ‘v’ in it, find shortest path from ‘u’ to ‘v’ with exactly k edges on the path.

## Count all possible walks from a source to a destination with exactly k edges

Given a directed graph and two vertices ‘u’ and ‘v’ in it, count all possible walks from ‘u’ to ‘v’ with exactly k edges on… Read More »

## Euler Circuit in a Directed Graph

Eulerian Path is a path in graph that visits every edge exactly once. Eulerian Circuit is an Eulerian Path which starts and ends on the… Read More »

## Find if an array of strings can be chained to form a circle | Set 1

Given an array of strings, find if the given strings can be chained to form a circle.

## Given a sorted dictionary of an alien language, find order of characters

Given a sorted dictionary (array of words) of an alien language, find order of characters in the language.

## Channel Assignment Problem

There are M transmitter and N receiver stations. Given a matrix that keeps track of the number of packets to be transmitted from a given… Read More »

## Some interesting shortest path questions | Set 1

Question 1: Given a directed weighted graph. You are also given the shortest path from a source vertex ‘s’ to a destination vertex ‘t’.  If… Read More »

## Graph Coloring | Set 2 (Greedy Algorithm)

We introduced graph coloring and applications in previous post. As discussed in the previous post, graph coloring is widely used.

## Graph Coloring | Set 1 (Introduction and Applications)

Graph coloring problem is to assign colors to certain elements of a graph subject to certain constraints.

## Johnson’s algorithm for All-pairs shortest paths

The problem is to find shortest paths between every pair of vertices in a given weighted directed Graph and weights may be negative. We have… Read More »

## Travelling Salesman Problem | Set 2 (Approximate using MST)

We introduced Travelling Salesman Problem and discussed Naive and Dynamic Programming Solutions for the problem in the previous post,. Both of the solutions are infeasible.

## Travelling Salesman Problem | Set 1 (Naive and Dynamic Programming)

Travelling Salesman Problem (TSP): Given a set of cities and distance between every pair of cities, the problem is to find the shortest p

## Detect cycle in an undirected graph

Given an undirected graph, how to check if there is a cycle in the graph? For example, the following graph has a cycle 1-0-2-1.

## Find maximum number of edge disjoint paths between two vertices

Given a directed graph and two vertices in it, source ‘s’ and destination ‘t’, find out the maximum number of edge disjoint paths from s… Read More »

## Longest Path in a Directed Acyclic Graph

Given a Weighted Directed Acyclic Graph (DAG) and a source vertex s in it, find the longest distances from s to all other vertices in… Read More »