We have learned about the Bellman-Ford Algorithm in Chapter 13 to solve the shortest path problem. The previous Wiki article dealt with the Dijkstra's algorithm, another way to compute the shortest path. Now let us suppose that there is an edge-weighted directed graph (digraph) with no directed cycles (image below). Is it easier to find the shortest path in this digraph than in a general digraph? Yes, it is using the concept of Topological sorting.
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v in the ordering. Topological Sorting for a graph is not possible if the graph is not a DAG. For example, the topological order for the graph above, after sorting, is as follows:
Read full article from Shortest paths in Acyclic edge-weighted digraphs - network20q wiki
No comments:
Post a Comment