First page Back Continue Last page Graphics
Preserving the Graph
How could we do it without destroying the graph?
By adding markings to the nodes again…
topSort(theGraph)
n = number of vertices in theGraph
for step = 1 through n) {
select a vertex v that has no unmarked
successors
aList.addFirst(v)
mark v
}
return aList