我有四个组件A,B,C,D
。哪个依赖关系流如A -> B -> C -> D
。
A取决于B,B取决于C,C取决于D.在这种情况下我应该使用哪种算法。
答案 0 :(得分:1)
您要查找的算法是拓扑排序。
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of
vertices such that for every directed edge u-v, vertex u comes before v in the
ordering. Topological Sorting for a graph is not possible if the graph is not
a DAG.