graph algorithms (empty figure an adjacency list representation of graph in most of the we present the graph algorithms using pseudocode we will do this to save space andof courseto make the presentation of the algorithms much clearer at the end of section we provide working +implementation of routine that makes underlying use of shortest-path algorithm to obtain its answers topological sort topological sort is an ordering of vertices in directed acyclic graphsuch that if there is path from vi to vj then vj appears after vi in the ordering the graph in figure represents the course prerequisite structure at state university in miami directed edge (vwindicates that course must be completed before course may be attempted topological ordering of these courses is any course sequence that does not violate the prerequisite requirement it is clear that topological ordering is not possible if the graph has cyclesince for two vertices and on the cyclev precedes and precedes furthermorethe ordering is not necessarily uniqueany legal ordering will do in the graph in figure and are both topological orderings simple algorithm to find topological ordering is first to find any vertex with no incoming edges we can then print this vertexand remove italong with its edgesfrom the graph then we apply this same strategy to the rest of the graph to formalize thiswe define the indegree of vertex as the number of edges (uvwe compute the indegrees of all vertices in the graph assuming that the indegree for each