Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Algorithm 我需要知道以下情况下我应该选择哪种算法_Algorithm_Sorting_Data Structures_Graph Algorithm_Storing Data - Fatal编程技术网

Algorithm 我需要知道以下情况下我应该选择哪种算法

Algorithm 我需要知道以下情况下我应该选择哪种算法,algorithm,sorting,data-structures,graph-algorithm,storing-data,Algorithm,Sorting,Data Structures,Graph Algorithm,Storing Data,我有四个组件A、B、C、D。哪个依赖项流类似于A->B->C->D。 A依赖于B,B依赖于C,C依赖于D。在这种情况下,我应该使用哪种类型的算法。您要查找的算法是拓扑排序 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 orderin

我有四个组件
A、B、C、D
。哪个依赖项流类似于
A->B->C->D

A依赖于B,B依赖于C,C依赖于D。在这种情况下,我应该使用哪种类型的算法。

您要查找的算法是拓扑排序

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.

请提供您正试图解决的用例的详细信息,也许有一个例子。另外,分享你已经尝试过的细节。目前提供的信息模糊且不完整。您好,您的问题太宽泛,请检查并将您的问题置于上下文中,在这种情况下,我认为没有人会理解您的观点。