← Abhinav Gupta

Topological Sorting (Kahn Algorithm)

October 14, 2019

Topological Sorting using Kahn Algorithm

Problem

Given a directed graph, you need to complete the function topoSort which returns an array having the topologically sorted elements of the array and takes two arguments.

The first argument is the Graph graph represented as adjacency list and the second is the number of vertices N.