Purchase Solution

Topological Sorting

Not what you're looking for?

Ask Custom Question

An algorithm for computing a topological ordering of a DAG (Directed Acyclic Graph) repeatedly finds a node with no incoming edges and deletes it. This will eventually produce a topological ordering, provided that the input graph really is a DAG.

But suppose that we're given an arbitrary graph that may or may not be a DAG. Extend the topological ordering algorithm so that given an input directed graph G it outputs one of two things: (a) a topological ordering, thus establishing that G is a DAG; or (b) a cycle in G, and
thus establishing that G is not a DAG. The running time of your algorithm should be O(m+n) for a directed graph with n nodes and medges.

Purchase this Solution

Solution Summary

The expert examines topological sorting algorithm for computing.

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

C++ Operators

This quiz tests a student's knowledge about C++ operators.