Introduction Topological sorting is a common operation performed on directed acyclic graphs (dags). It arises in numerous applications including task scheduling, serialization and dependency determinations, and graph drawing. The goal of this project is to manipulate graph representations, perform topological sorting on a dag, and use the topological numbers in a longest path computation as well as in a heuristic solving a scheduling problem. Degree-based Topological Sort Given is a dag G=(V,E), V={0, 1, … ,n-1}, having n vertices and m edges. The graph is represented in the form of adjacency lists. For each vertex u, Aout[u] points to a list containing all vertices v such that <u,v> is an edge from u to v and Ain[u] points to a list containing all vertices v such that <v,u> is an edge from v to u. The length of list Aout[u] is the out-degree of node u and the length of list Ain[u] is the in-degree of node u. In any dag there exists at least one vertex having in-degree 0 (called the sources) and at least one vertex with out-degree 0 (called the sinks). The dags used in the project can have an arbitrary number of sources, but will always have one sink. The dag shown in Figure 1 has two sources (vertices A and G) and one sink (vertex F). Figure 1: A 7-vertex dag with two sources and one sink. Topological sorting assigns to each vertex an integer (also called its topological number). See Chapter 4.2 in the text for details. The topological numbers represent a linear ordering of the vertices such that for every edge <u,v> vertex u appears before v in the ordering. For the graph in Figure 1, the ordering A G B D C E F is a topological ordering and the topological numbers are A=0, B=2, C=4, D=3, E=5, F=6, G=1. Note that topological orderings are not unique. We note that the textbook presents topological sorting as an application of DFS (Algorithm 4.5 in Chapter 4.2). Another approach is a non-recursive implementation based on a degree-driven graph exploration. In this project you need to implement the degree-based topological sorting approach described below. All source vertices are ready to be placed. For Figure 1, vertices A and G can be placed right away. Once a vertex u has all the vertices incident to its incoming edges placed, u can be placed. This observation forms the basis of degree-based topological sorting algorithm. The algorithm uses a queue TSQ. Whether one uses a FIFO or a LIFO (i.e., stack) queue does not matter for determining a topological ordering (different queues will produce different orderings). The topological numbers are maintained in an array, say array T. The high-level description of the degree-driven algorithm is as follows: 1 Make all initializations; includes a variable count set to 0 and placing all sources in queue TSQ. 2 u = dequeue() and we set T[u]=count 3 All of u’s out-going edges are examined. For each edge <u,v>, reduce the number of edges into v by 1. Once all incoming edges of vertex v have received topolo.