public static List <int> TopologicalSort(List <int> jobs, List <int[]> deps)
        {
            // Write your code here.
            JobGraph jobGraph = CreateJobGraph(jobs, deps);

            return(getOrderedGraphs(jobGraph));
        }
        public static JobGraph CreateJobGraph(List <int> jobs, List <int[]> deps)
        {
            JobGraph jobGraph = new JobGraph(jobs);

            foreach (int[] dep in deps)
            {
                jobGraph.addPrereq(dep[1], dep[0]);
            }

            return(jobGraph);
        }
        public static List <int> getOrderedGraphs(JobGraph jobGraph)
        {
            List <int> topologicalSort = new List <int>();

            foreach (JobNode node in jobGraph.nodes)
            {
                bool containsCycle = getTopologicalSort(node, topologicalSort);
                if (containsCycle)
                {
                    return(new List <int>());
                }
            }

            return(topologicalSort);
        }