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.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.