First page Back Continue Last page Graphics
A simple algorithm
topSort(theGraph)
n = number of vertices in theGraph
for step = 1 through n) {
select a vertex v that has no successors
aList.addFirst(v)
delete from theGraph v and all edges to it.
}
return aList