Abstract

In the case of finding the topological ordering of a directed acyclic graph (DAG), kahn’s and Depth First Search (DFS) topological sorting algorithms are used. Both of these algorithms time complexity is O(|V| + |E|). Here a topological sorting algorithm is proposed that is completely new and it reduces the time complexity of the previous algorithms. By separating the vertices having outgoing edges and the vertices having no outgoing edges then removing outgoing edges step by step, we can find a topological ordering of any DAG. The time complexity after using the proposed algorithm reduces to \( {\text{O}}\left( {\sum\nolimits_{i = 1}^{\left| v \right|} {\left| {\left( {NE} \right)_{i} } \right|} } \right) \) for both average case and worst case but for best case it reduce to O(|V|), here |V| is the number of vertex and |(NE)| is the number of vertex contains at least one outgoing edge. This algorithm also can detect cycle in a graph. This algorithm cab be used for resolving dependencies, scheduling system, planning and in many graph algorithms.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call