******** fig9.5 ********** void topsort( graph G ) { unsigned int counter; vertex v, w; for( counter=0; counter < NUM_VERTEX; counter++ ) { v = find_new_vertex_of_indegree_zero; if( v == NOT_A_VERTEX ) { error("Graph has a cycle"); break; } top_num[v] = counter; for each w adjacent to v indegree[w]--; } }