This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

### Categories

### Publishers

Scribd Selects Books

Hand-picked favorites from

our editors

our editors

Scribd Selects Audiobooks

Hand-picked favorites from

our editors

our editors

Scribd Selects Comics

Hand-picked favorites from

our editors

our editors

Scribd Selects Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

P. 1

Algorithms Design Techniques and Analysis|Views: 215|Likes: 11

Published by narasimha2357

See more

See less

https://www.scribd.com/doc/49137176/Algorithms-Design-Techniques-and-Analysis

09/23/2012

text

original

Given a directed acyclic graph (dag for short) G = (V,E), the problem

of topological sorting is to ﬁnd a linear ordering of its vertices in such a

way that if (v,w) ∈ E, then v appears before w in the ordering. For

example, one possible topological sorting of the vertices in the dag shown

in Fig. 9.3(a) is a,b,d,c,e,f,g. We will assume that the dag has only one

vertex, say s, of indegree 0. If not, we may simply add a new vertex s and

edges from s to all vertices of indegree 0 (see Fig. 9.3(b)).

Next, we simply carry out a depth-ﬁrst search on G starting at vertex s.

When the traversal is complete, the values of the counter postdfn deﬁne

a reverse topological ordering of the vertices in the dag. Thus, to obtain

Applications of Depth-First Search

263

f

e

c

d

a

b

g

s

f

e

c

d

a

b

g

(a)

(b)

Fig. 9.3 Illustration of topological sorting.

the ordering, we may add an output step to Algorithm dfs just after the

counter postdfn is incremented. The resulting output is reversed to obtain

the desired topological ordering.

- Read and print without ads
- Download to keep your version
- Edit, email or read offline

DAA

full notes

Design and Analysis of Algorithms

Graphs

Algorithm Analysis and Design

A Algorithm for the time-dependent shortest path problem

daa 1mark questions and answers

CS2251-QB

Intro Notes

Articulation Point using DFS - Algorithm

Design and Analysis of Algorithm

Graphs 1

DAA2M

451lects

DFS and BFS

CS502_all

Algorithm Graphs with solution

Technical

Introduction to the Design & Analysis of Algorithms 2ND Edition by Anany Levitin

Algo Notes Tirupattur

C++ Network Programming Volume 1

Problems on Algorithms 2nd Edition

Introduction to Lisp

shortest common superstring1

Linear and quadratic approximations

Graphs

selva

daa

Time Complexities of Sorting Algorithms

DAA Tutorials

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

CANCEL

OK

You've been reading!

NO, THANKS

OK

scribd

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->