更改

跳到导航 跳到搜索
添加8,589字节 、 2021年5月31日 (一) 09:09
无编辑摘要
第41行: 第41行:     
== Mathematical properties ==
 
== Mathematical properties ==
−
数学性质  
+
== 数学性质 ==
       
=== Reachability, transitive closure, and transitive reduction ===
 
=== Reachability, transitive closure, and transitive reduction ===
−
可达性,传递闭包和传递约束  
+
=== 可达性,传递闭包和传递约束 ===
 
{{multiple image|image1=Tred-G.svg
 
{{multiple image|image1=Tred-G.svg
 
|width1=175|image2=Tred-Gprime.svg|width2=124|caption1=A DAG {{mvar|G}}|caption2=Transitive reduction of {{mvar|G}}}}
 
|width1=175|image2=Tred-Gprime.svg|width2=124|caption1=A DAG {{mvar|G}}|caption2=Transitive reduction of {{mvar|G}}}}
第106行: 第106行:  
A topological ordering of a directed graph is an ordering of its vertices into a sequence, such that for every edge the start vertex of the edge occurs earlier in the sequence than the ending vertex of the edge. A graph that has a topological ordering cannot have any cycles, because the edge into the earliest vertex of a cycle would have to be oriented the wrong way. Therefore, every graph with a topological ordering is acyclic. Conversely, every directed acyclic graph has at least one topological ordering. The existence of a topological ordering can therefore be used as an equivalent definition of a directed acyclic graphs: they are exactly the graphs that have topological orderings.
 
A topological ordering of a directed graph is an ordering of its vertices into a sequence, such that for every edge the start vertex of the edge occurs earlier in the sequence than the ending vertex of the edge. A graph that has a topological ordering cannot have any cycles, because the edge into the earliest vertex of a cycle would have to be oriented the wrong way. Therefore, every graph with a topological ordering is acyclic. Conversely, every directed acyclic graph has at least one topological ordering. The existence of a topological ordering can therefore be used as an equivalent definition of a directed acyclic graphs: they are exactly the graphs that have topological orderings.
    +
有向图的拓扑排序是将其顶点排序成一个序列,这样,对于每一条边,边的起点在序列中出现的时间早于边的终点。一个有拓扑顺序的图不能有圈,因为圈最早点的边必须定向错误。因此,每个具有拓扑序的图都是无循环的。相反,每个有向无环图至少有一个拓扑序。因此,拓扑序的存在可以用作有向无圈图的等价定义: 它们正是具有拓扑序的图。
    
In general, this ordering is not unique; a DAG has a unique topological ordering if and only if it has a directed path containing all the vertices, in which case the ordering is the same as the order in which the vertices appear in the path.<ref>{{citation|title=Algorithms|first1=Robert|last1=Sedgewick|author1-link=Robert Sedgewick (computer scientist)|first2=Kevin|last2=Wayne|edition=4th|publisher=Addison-Wesley|year=2011|isbn=978-0-13-276256-4|url=https://books.google.com/books?id=idUdqdDXqnAC&pg=PA598|pages=598–599|contribution=4,2,25 Unique topological ordering}}.</ref>
 
In general, this ordering is not unique; a DAG has a unique topological ordering if and only if it has a directed path containing all the vertices, in which case the ordering is the same as the order in which the vertices appear in the path.<ref>{{citation|title=Algorithms|first1=Robert|last1=Sedgewick|author1-link=Robert Sedgewick (computer scientist)|first2=Kevin|last2=Wayne|edition=4th|publisher=Addison-Wesley|year=2011|isbn=978-0-13-276256-4|url=https://books.google.com/books?id=idUdqdDXqnAC&pg=PA598|pages=598–599|contribution=4,2,25 Unique topological ordering}}.</ref>
   −
有向无环图的<font color="#ff8000"> 拓扑排序Topological ordering</font>为  <font color="#32cd32"> 为所有边的起点都出现在其终点之前的排序。</font>
  −
能构成拓扑排序的图一定没有环,因为环中的一条边必定从排序较后的顶点指向比其排序更前的顶点。
  −
基于此,拓扑排序可以被用来定义有向无环图:当且仅当一个有向图有拓扑排序,它是有向无环图。[2]
  −
一般情况下,拓扑排序并非唯一。有向无环图仅仅在存在一条路径可以包含其所有顶点的情况下,有唯一的拓扑排序方式,这时,拓扑排序与它们在这条路径中出现的顺序相同。[9]
         
The family of topological orderings of a DAG is the same as the family of linear extensions of the reachability relation for the DAG, so any two graphs representing the same partial order have the same set of topological orders.
 
The family of topological orderings of a DAG is the same as the family of linear extensions of the reachability relation for the DAG, so any two graphs representing the same partial order have the same set of topological orders.
   −
 
+
有向无环图的拓扑序族与有向无环图的可达关系的线性扩张族相同,因此任意两个表示相同偏序的图具有相同的拓扑序集。
    
The family of topological orderings of a DAG is the same as the family of [[linear extension]]s of the reachability relation for the DAG,<ref>{{citation|title=A Short Course in Discrete Mathematics|series=Dover Books on Computer Science|first1=Edward A.|last1=Bender|first2=S. Gill|last2=Williamson|publisher=Courier Dover Publications|year=2005|isbn=978-0-486-43946-4|page=142|url=https://books.google.com/books?id=iuEoAwAAQBAJ&pg=PA142|contribution=Example 26 (Linear extensions – topological sorts)}}.</ref> so any two graphs representing the same partial order have the same set of topological orders.
 
The family of topological orderings of a DAG is the same as the family of [[linear extension]]s of the reachability relation for the DAG,<ref>{{citation|title=A Short Course in Discrete Mathematics|series=Dover Books on Computer Science|first1=Edward A.|last1=Bender|first2=S. Gill|last2=Williamson|publisher=Courier Dover Publications|year=2005|isbn=978-0-486-43946-4|page=142|url=https://books.google.com/books?id=iuEoAwAAQBAJ&pg=PA142|contribution=Example 26 (Linear extensions – topological sorts)}}.</ref> so any two graphs representing the same partial order have the same set of topological orders.
−
  −
有向无环图的拓扑排序族等同于其可达性的<font color="#ff8000"> 线性拓展Linear extension
  −
</font>族。 [10]因此,偏序关系相同的任意两个图会有相同的拓扑排序集。
        第136行: 第130行:  
The number of DAGs on  labeled vertices, for  (without restrictions on the order in which these numbers appear in a topological ordering of the DAG) is
 
The number of DAGs on  labeled vertices, for  (without restrictions on the order in which these numbers appear in a topological ordering of the DAG) is
   −
组合计数
+
在有标记的顶点上的 DAGs 数量为(对这些数字在有向无环图的拓扑顺序中出现的顺序没有限制)
−
<font color="#ff8000"> 罗宾逊 Robinson</font>(1973)研究了有向无环图的<font color="#ff8000"> 图计数Graph enumeration</font>问题。[12] 对于n = 0, 1, 2, 3, …(<font color="#32cd32"> 出现在有向无环图的拓扑排序的这些数字的序列没有限制</font>)的n个标记的顶点的有向无环图的数量是1, 1, 3, 25, 543, 29281, 3781503, … (OEIS中的数列A003024)。
  −
 
  −
这个数列的<font color="#ff8000"> 递推关系式 Recurrence relation</font>是
  −
 
  −
 
      
|last1 = Harary | first1 = Frank | author1-link = Frank Harary | first2 = Edgar M. | last2 = Palmer | year =  1973| title = Graphical Enumeration  | publisher = [[Academic Press]] | isbn = 978-0-12-324245-7 | page=19}}.</ref>
 
|last1 = Harary | first1 = Frank | author1-link = Frank Harary | first2 = Edgar M. | last2 = Palmer | year =  1973| title = Graphical Enumeration  | publisher = [[Academic Press]] | isbn = 978-0-12-324245-7 | page=19}}.</ref>
第151行: 第140行:  
These numbers may be computed by the recurrence relation
 
These numbers may be computed by the recurrence relation
    +
这些数字可能是由美国递回关系式计算出来的
    
:1, 1, 3, 25, 543, 29281, 3781503, … {{OEIS|id=A003024}}.
 
:1, 1, 3, 25, 543, 29281, 3781503, … {{OEIS|id=A003024}}.
第156行: 第146行:  
<math>a_n = \sum_{k=1}^n (-1)^{k-1} {n\choose k}2^{k(n-k)} a_{n-k}.</math> and  proved, that the same numbers count the (0,1) matrices for which all eigenvalues are positive real numbers. The proof is bijective: a matrix  is an adjacency matrix of a DAG if and only if  is a (0,1) matrix with all eigenvalues positive, where  denotes the identity matrix. Because a DAG cannot have self-loops, its adjacency matrix must have a zero diagonal, so adding  preserves the property that all matrix coefficients are 0 or 1.
 
<math>a_n = \sum_{k=1}^n (-1)^{k-1} {n\choose k}2^{k(n-k)} a_{n-k}.</math> and  proved, that the same numbers count the (0,1) matrices for which all eigenvalues are positive real numbers. The proof is bijective: a matrix  is an adjacency matrix of a DAG if and only if  is a (0,1) matrix with all eigenvalues positive, where  denotes the identity matrix. Because a DAG cannot have self-loops, its adjacency matrix must have a zero diagonal, so adding  preserves the property that all matrix coefficients are 0 or 1.
   −
<font color="#ff8000"> 埃里克·韦斯坦因 Eric W. Weisstein</font>推测[13],n个顶点的标号有向无环图的数量与其中所有特征值都为正实数的n*n逻辑矩阵的数量相同。这一点随后被<font color="#ff8000"> McKay</font> et al. (2004) 证实,证明采用了<font color="#ff8000"> 双射法Bijective</font>:一个矩阵A是有向无环图的一个<font color="#ff8000"> 邻接矩阵Adjacency matrix</font>,当且仅当A + I 是一个所有特征值都为正数的逻辑矩阵,其中I 为<font color="#ff8000"> 单位矩阵 Identity matrix</font>。因为一个有向无环图不允许<font color="#ff8000"> 自环Self-loops</font>,它的邻接矩阵的对角线必定全为0。因此,加上I 保持了所有矩阵因子都是0或1的特性。[13]
+
<math>a_n = \sum_{k=1}^n (-1)^{k-1} {n\choose k}2^{k(n-k)} a_{n-k}.</math>证明了同一个数可以计算所有特征值为正实数的(0,1)矩阵。证明是双射的: 一个矩阵是一个 DAG 的邻接矩阵当且仅当它是一个所有特征值为正的矩阵,其中表示单位矩阵。因为一个 DAG 不能有自循环,所以它的邻接矩阵必须有一个零对角线,所以加上这一点保留了所有矩阵系数都是0或1的性质。
−
 
      
These numbers may be computed by the [[recurrence relation]]
 
These numbers may be computed by the [[recurrence relation]]
第168行: 第157行:  
=== Related families of graphs ===
 
=== Related families of graphs ===
 
{{multiple image
 
{{multiple image
−
|image1=Polytree.svg|caption1=A [[polytree]], a DAG formed by [[Orientation (graph theory)|orienting]] the edges of an undirected tree  
+
|image1=Polytree.svg|caption1=A [[polytree]], a DAG formed by [[Orientation (graph theory)|orienting]] the edges of an undirected tree 一个多树,一个 DAG,其中每个从单个顶点(红色)可到达的子图是一棵树
−
|image2=Butterfly multitree.svg|caption2=A [[multitree]], A DAG in which each subgraph reachable from a single vertex (red) is a tree
+
|image2=Butterfly multitree.svg|caption2=A [[multitree]], A DAG in which each subgraph reachable from a single vertex (red) is a tree 一个多边形是一个有向图形成的定向的边自由树。每棵多叶树都是一个 DAG。特别是,这是真正的树枝形成的所有边缘向外从树根。
 
|width2=254<!---adjust to make both images the same height-->  
 
|width2=254<!---adjust to make both images the same height-->  
 
}}
 
}}
第175行: 第164行:  
A multitree (also called a strongly unambiguous graph or a mangrove) is a directed graph in which there is at most one directed path (in either direction) between any two vertices; equivalently, it is a DAG in which, for every vertex , the subgraph reachable from  forms a tree.
 
A multitree (also called a strongly unambiguous graph or a mangrove) is a directed graph in which there is at most one directed path (in either direction) between any two vertices; equivalently, it is a DAG in which, for every vertex , the subgraph reachable from  forms a tree.
   −
<font color="#ff8000"> 多重树Polytree</font>由将<font color="#ff8000"> 自由树 Free tree</font>的边<font color="#ff8000"> 定向Orienting</font>而得到。[14] 多重树必定是有向无环图。对于有根树,将其所有边赋予指离根的方向也可以得到有向无环图,即<font color="#ff8000"> 树状图Arborescences </font>。
+
多重树(也称为强无歧义图或红树)是一个有向图,其中任意两个顶点之间至多有一条有向路(任意方向) ; 等价地,它是一个有向无环图,其中对于每个顶点,从该子图可达到的子图形成一棵树。
    
A [[polytree]] is a directed graph formed by orienting the edges of a [[tree (graph theory)|free tree]].<ref>{{citation | last1 = Rebane | first1 = George | last2 = Pearl | first2 = Judea | author2-link = Judea Pearl | contribution = The recovery of causal poly-trees from statistical data | pages = 222–228 | title = in Proc. 3rd Annual Conference on Uncertainty in Artificial Intelligence (UAI 1987), Seattle, WA, USA, July 1987 | url = ftp://ftp.cs.ucla.edu/tech-report/198_-reports/870031.pdf | year = 1987 }}{{Dead link|date=July 2019 |bot=InternetArchiveBot |fix-attempted=yes }}.</ref>Every polytree is a DAG. In particular, this is true of the [[Arborescence (graph theory)|arborescences]] formed by directing all edges outwards from the roots of a tree.
 
A [[polytree]] is a directed graph formed by orienting the edges of a [[tree (graph theory)|free tree]].<ref>{{citation | last1 = Rebane | first1 = George | last2 = Pearl | first2 = Judea | author2-link = Judea Pearl | contribution = The recovery of causal poly-trees from statistical data | pages = 222–228 | title = in Proc. 3rd Annual Conference on Uncertainty in Artificial Intelligence (UAI 1987), Seattle, WA, USA, July 1987 | url = ftp://ftp.cs.ucla.edu/tech-report/198_-reports/870031.pdf | year = 1987 }}{{Dead link|date=July 2019 |bot=InternetArchiveBot |fix-attempted=yes }}.</ref>Every polytree is a DAG. In particular, this is true of the [[Arborescence (graph theory)|arborescences]] formed by directing all edges outwards from the roots of a tree.
    
A [[multitree]] (also called a strongly unambiguous graph or a mangrove) is a directed graph in which there is at most one directed path (in either direction) between any two vertices; equivalently, it is a DAG in which, for every vertex {{mvar|v}}, the subgraph reachable from {{mvar|v}} forms a tree.<ref>{{citation | last1 = Furnas | first1 = George W. | author1-link = George Furnas | last2 = Zacks | first2 = Jeff | contribution = Multitrees: enriching and reusing hierarchical structure | doi = 10.1145/191666.191778 | pages = 330–336 | title = Proc. SIGCHI conference on Human Factors in Computing Systems (CHI '94) | year = 1994| isbn = 978-0897916509 | s2cid = 18710118 }}.</ref>
 
A [[multitree]] (also called a strongly unambiguous graph or a mangrove) is a directed graph in which there is at most one directed path (in either direction) between any two vertices; equivalently, it is a DAG in which, for every vertex {{mvar|v}}, the subgraph reachable from {{mvar|v}} forms a tree.<ref>{{citation | last1 = Furnas | first1 = George W. | author1-link = George Furnas | last2 = Zacks | first2 = Jeff | contribution = Multitrees: enriching and reusing hierarchical structure | doi = 10.1145/191666.191778 | pages = 330–336 | title = Proc. SIGCHI conference on Human Factors in Computing Systems (CHI '94) | year = 1994| isbn = 978-0897916509 | s2cid = 18710118 }}.</ref>
−
<font color="#ff8000"> 强明确树Multitree</font>是每两个顶点最多被一条路径所连接的有向无环图。等价的说,它是满足以下性质的一个有向无环图:对于图中每个顶点v,从v可达的顶点组成一颗树。[15]
+
 
    
== Computational problems ==
 
== Computational problems ==
−
CLUE
     −
NOTE
+
=== Topological sorting and recognition ===
−
In mathematics, particularly graph theory, and computer science, a directed acyclic graph (DAG or dag /ˈdæɡ/ (About this soundlisten)) is a directed graph with no directed cycles. That is, it consists of vertices and edges (also called arcs), with each edge directed from one vertex to another, such that following those directions will never form a closed loop. A directed graph is a DAG if and only if it can be topologically ordered, by arranging the vertices as a linear ordering that is consistent with all edge directions. DAGs have numerous scientific and computational applications, ranging from biology (evolution, family trees, epidemiology) to sociology (citation networks) to computation (scheduling).
+
 
−
在数学中,特别是 图论(graph theory)和计算机科学(computer science),有向无环图(DAG or dag)是没有定向循环的有方向的图(directed graph)。即 有向无环图包含节点 和边,每一条边从一个节点指向另一个节点,沿着这些节点的方向 不会形成一个闭合的环。一个有向图是有向无环图当且仅当它是拓扑有序的(topologically ordered), 通过将节点排列成与所有边的方向一致的线性顺序。有向无环图有众多科学的和计算的应用,覆盖从生物学(进化, 家谱, 流行病学)、社会学(引用网络)到 计算(调度)。
+
Topological sorting is the algorithmic problem of finding a topological ordering of a given DAG. It can be solved in linear time. Kahn's algorithm for topological sorting builds the vertex ordering directly. It maintains a list of vertices that have no incoming edges from other vertices that have not already been included in the partially constructed topological ordering; initially this list consists of the vertices with no incoming edges at all. Then, it repeatedly adds one vertex from this list to the end of the partially constructed topological ordering, and checks whether its neighbors should be added to the list. The algorithm terminates when all vertices have been processed in this way. or alternatively, for some topological sorting algorithms, by verifying that the algorithm successfully orders all the vertices without meeting an error condition.
 +
 
 +
拓扑排序是寻找给定 DAG 的拓扑顺序的计算问题。它可以在线性时间内求解。的拓扑排序算法直接建立顶点排序。它维护了一个顶点列表,这些顶点没有来自其他没有被部分构造的拓扑顺序包括在内的顶点的入射边; 最初这个列表由没有入射边的顶点组成。然后,它重复地从这个列表中添加一个顶点到部分构造的拓扑排序的末尾,并检查它的邻居是否应该添加到这个列表中。当所有顶点都以这种方式被处理时,算法终止。或者,对于某些拓扑排序算法,通过验证算法成功地排序所有顶点,而不满足错误条件。
 +
 
 +
=== Construction from cyclic graphs ===
 +
 
 +
 
 +
 
 +
 
 +
Any undirected graph may be made into a DAG by choosing a total order for its vertices and directing every edge from the earlier endpoint in the order to the later endpoint. The resulting orientation of the edges is called an acyclic orientation. Different total orders may lead to the same acyclic orientation, so an -vertex graph can have fewer than  acyclic orientations. The number of acyclic orientations is equal to χ(−1)}}, where  is the chromatic polynomial of the given graph.
 +
 
 +
任何无向图都可以通过为其顶点选择一个总的顺序,并按顺序将前一个端点的每条边定向到后一个端点,从而构成一个 DAG。所得到的边的方向称为无圈方向。不同的总序可能导致相同的无圈取向,因此一个顶点图可以有少于个无圈取向。非循环取向的个数等于 χ (- 1)} ,其中是给定图的色多项式。
 +
 
 +
 
 +
[[File:Graph Condensation.svg|thumb|upright=1.5|The yellow directed acyclic graph is the [[Condensation (graph theory)|condensation]] of the blue directed graph. It is formed by [[Edge contraction|contracting]] each [[strongly connected component]] of the blue graph into a single yellow vertex.]]
 +
 
 +
Any directed graph may be made into a DAG by removing a feedback vertex set or a feedback arc set, a set of vertices or edges (respectively) that touches all cycles. However, the smallest such set is NP-hard to find. An arbitrary directed graph may also be transformed into a DAG, called its condensation, by contracting each of its strongly connected components into a single supervertex. When the graph is already acyclic, its smallest feedback vertex sets and feedback arc sets are empty, and its condensation is the graph itself.
 +
 
 +
任何有向图都可以通过删除一个反馈顶点集或一个反馈弧集、一组顶点或边(分别)来构成一个有向无环图。然而,最小的这样的集合是 np 难以找到。一个任意的有向图也可以通过将每个强连通分量收缩到一个单独的超顶点而转化为 DAG,称为它的凝聚。当图是非循环的时候,它的最小反馈顶点集和反馈弧集是空的,它的缩聚就是图本身。
 +
 
 +
 
 +
=== Transitive closure and transitive reduction ===
 +
 
 +
The transitive closure of a given DAG, with {{mvar|n}} vertices and {{mvar|m}} edges, may be constructed in time {{math|''O''(''mn'')}} by using either [[breadth-first search]] or [[depth-first search]] to test reachability from each vertex.<ref>{{harvtxt|Skiena|2009}}, p. 495.</ref> Alternatively, it can be solved in time {{math|''O''(''n''<sup>''ω''</sup>)}} where {{math|''ω''&nbsp;<&nbsp;2.373}} is the [[Computational complexity of matrix multiplication#Matrix multiplication exponent|exponent for matrix multiplication algorithms]]; this is a theoretical improvement over the {{math|''O''(''mn'')}} bound for [[dense graph]]s.<ref>{{harvtxt|Skiena|2009}}, p. 496.</ref>
 +
 
 +
The transitive closure of a given DAG, with vertices and  edges, may be constructed in time  by using either breadth-first search or depth-first search to test reachability from each vertex. Alternatively, it can be solved in time  where  is the exponent for matrix multiplication algorithms; this is a theoretical improvement over the  bound for dense graphs.
 +
 
 +
一个给定的有向无环图的传递闭包,包括顶点和边,可以通过使用广度优先搜索或深度优先搜索来测试每个顶点的可达性来及时构造。或者,它可以及时解决在哪里是矩阵乘法算法的指数; 这是一个理论上的改进超过了稠密图的界。
 +
 
 +
In all of these transitive closure algorithms, it is possible to distinguish pairs of vertices that are reachable by at least one path of length two or more from pairs that can only be connected by a length-one path. The transitive reduction consists of the edges that form length-one paths that are the only paths connecting their endpoints. Therefore, the transitive reduction can be constructed in the same asymptotic time bounds as the transitive closure.<ref>{{harvtxt|Bang-Jensen|Gutin|2008}}, p. 38.</ref>
 +
 
 +
In all of these transitive closure algorithms, it is possible to distinguish pairs of vertices that are reachable by at least one path of length two or more from pairs that can only be connected by a length-one path. The transitive reduction consists of the edges that form length-one paths that are the only paths connecting their endpoints. Therefore, the transitive reduction can be constructed in the same asymptotic time bounds as the transitive closure.
 +
 
 +
在所有这些传递闭包算法中,可以区分至少一条长度为2条或更多的路径可到达的顶点对和只能通过一条长度为1条路径连接的顶点对。传递约简由形成长度的边组成——一条路径是连接其端点的唯一路径。因此,传递约简可以在与传递闭包相同的渐近时间范围内构造。
 +
 
 +
 
 +
=== Closure problem ===
 +
The [[closure problem]] takes as input a vertex-weighted directed acyclic graph and seeks the minimum (or maximum) weight of a closure – a set of vertices ''C'', such that no edges leave ''C''. The problem may be formulated for directed graphs without the assumption of acyclicity, but with no greater generality, because in this case it is equivalent to the same problem on the condensation of the graph. It may be solved in polynomial time using a reduction to the [[maximum flow problem]].<ref>{{citation | last = Picard | first = Jean-Claude | doi = 10.1287/mnsc.22.11.1268 | issue = 11
 +
| journal = [[Management Science (journal)|Management Science]] | mr = 0403596 | pages = 1268–1272 | title = Maximal closure of a graph and applications to combinatorial problems | volume = 22
 +
| year = 1976}}.</ref>
 +
 
 +
The closure problem takes as input a vertex-weighted directed acyclic graph and seeks the minimum (or maximum) weight of a closure – a set of vertices C, such that no edges leave C. The problem may be formulated for directed graphs without the assumption of acyclicity, but with no greater generality, because in this case it is equivalent to the same problem on the condensation of the graph. It may be solved in polynomial time using a reduction to the maximum flow problem.
 +
 
 +
闭包问题以一个顶点加权有向无环图为输入,寻求一个闭包的最小(或最大)权重-一组顶点 c,这样没有边离开 c。这个问题可以在没有无环性假设的情况下表示为有向图,但没有更大的一般性,因为在这种情况下,它等价于图的凝聚上的同样问题。通过对最大流问题的约简,可以在多项式时间内求解。
 +
 
 +
 
 +
=== Path algorithms ===
 +
Some algorithms become simpler when used on DAGs instead of general graphs, based on the principle of topological ordering. For example, it is possible to find [[shortest path]]s and [[longest path problem|longest paths]] from a given starting vertex in DAGs in linear time by [[Topological sorting#Application to shortest path finding|processing the vertices in a topological order]], and calculating the path length for each vertex to be the minimum or maximum length obtained via any of its incoming edges.<ref>Cormen et al. 2001, Section 24.2, Single-source shortest paths in directed acyclic graphs, pp. 592–595.</ref> In contrast, for arbitrary graphs the shortest path may require slower algorithms such as [[Dijkstra's algorithm]] or the [[Bellman–Ford algorithm]],<ref>Cormen et al. 2001, Sections 24.1, The Bellman–Ford algorithm, pp. 588–592, and 24.3, Dijkstra's algorithm, pp. 595–601.</ref> and longest paths in arbitrary graphs are [[NP-hard]] to find.<ref>Cormen et al. 2001, p. 966.</ref>
 +
 
 +
Some algorithms become simpler when used on DAGs instead of general graphs, based on the principle of topological ordering. For example, it is possible to find shortest paths and longest paths from a given starting vertex in DAGs in linear time by processing the vertices in a topological order, and calculating the path length for each vertex to be the minimum or maximum length obtained via any of its incoming edges. In contrast, for arbitrary graphs the shortest path may require slower algorithms such as Dijkstra's algorithm or the Bellman–Ford algorithm, and longest paths in arbitrary graphs are NP-hard to find.
 +
 
 +
基于拓扑排序原理,有些算法用在 DAGs 上代替一般图时变得更简单。例如,通过处理拓扑有序中的顶点,并计算每个顶点的路径长度为通过任一传入边得到的最小或最大长度,可以在线性时间内从给定的 DAGs 顶点找到最短路径和最长路径。相反,对于任意图,最短路径可能需要较慢的算法,如 Dijkstra 算法或 Bellman-Ford 算法,而任意图中的最长路径是 np 难以找到的。
 +
 
 +
== Computational problems ==
 +
 
 +
 
 +
 
 +
 
 +
 
 +
=== Topological sorting and recognition ===
 +
 
 +
{{Main|Topological sorting}}
 +
 
 +
[[Topological sorting]] is the algorithmic problem of finding a topological ordering of a given DAG. It can be solved in [[linear time]].<ref name="clrs">{{Introduction to Algorithms|edition=2|mode=cs2}}  Section 22.4, Topological sort, pp. 549–552.</ref> Kahn's algorithm for topological sorting builds the vertex ordering directly. It maintains a list of vertices that have no incoming edges from other vertices that have not already been included in the partially constructed topological ordering; initially this list consists of the vertices with no incoming edges at all. Then, it repeatedly adds one vertex from this list to the end of the partially constructed topological ordering, and checks whether its neighbors should be added to the list. The algorithm terminates when all vertices have been processed in this way.<ref name="j50" /> Alternatively, a topological ordering may be constructed by reversing a [[postorder]] numbering of a [[depth-first search]] graph traversal.<ref name="clrs" />
 +
 
 +
 
 +
 
 +
It is also possible to check whether a given directed graph is a DAG in linear time, either by attempting to find a topological ordering and then testing for each edge whether the resulting ordering is valid<ref>For [[depth-first search]] based topological sorting algorithm, this validity check can be interleaved with the topological sorting algorithm itself; see e.g. {{citation|title=The Algorithm Design Manual|first=Steven S.|last=Skiena|publisher=Springer|year=2009|isbn=978-1-84800-070-4|pages=179–181|url=https://books.google.com/books?id=7XUSn0IKQEgC&pg=PA179}}.</ref> or alternatively, for some topological sorting algorithms, by verifying that the algorithm successfully orders all the vertices without meeting an error condition.<ref name="j50">{{harvtxt|Jungnickel|2012}}, pp. 50–51.</ref>
 +
 
 +
Directed acyclic graphs representations of partial orderings have many applications in scheduling for systems of tasks with ordering constraints.
 +
 
 +
偏序的有向无圈图表示在有序约束的任务系统的调度中有许多应用。
 +
 
 +
 
 +
 
 +
An important class of problems of this type concern collections of objects that need to be updated, such as the cells of a spreadsheet after one of the cells has been changed, or the object files of a piece of computer software after its source code has been changed.
 +
 
 +
这种类型的一类重要问题涉及需要更新的对象集合,例如电子表格中某个单元格更改后的单元格,或者计算机软件中某个源代码更改后的目标文件。
 +
 
 +
=== Construction from cyclic graphs ===
 +
 
 +
In this context, a dependency graph is a graph that has a vertex for each object to be updated, and an edge connecting two objects whenever one of them needs to be updated earlier than the other. A cycle in this graph is called a circular dependency, and is generally not allowed, because there would be no way to consistently schedule the tasks involved in the cycle.
 +
 
 +
在此上下文中,依赖关系图是一个图,其中每个要更新的对象都有一个顶点,并且每当其中一个对象需要比另一个更早更新时,就有一条连接两个对象的边。这个图中的循环称为循环依赖,通常不允许这样做,因为没有办法始终如一地安排循环中涉及的任务。
 +
 
 +
Any undirected graph may be made into a DAG by choosing a [[total order]] for its vertices and directing every edge from the earlier endpoint in the order to the later endpoint. The resulting [[Orientation (graph theory)|orientation]] of the edges is called an [[acyclic orientation]]. Different total orders may lead to the same acyclic orientation, so an {{mvar|n}}-vertex graph can have fewer than {{math|''n''!}} acyclic orientations. The number of acyclic orientations is equal to {{math|{{!}}''χ''(−1){{!}}}}, where {{mvar|χ}} is the [[chromatic polynomial]] of the given graph.<ref>{{citation|first=Richard P.|last=Stanley|author-link=Richard P. Stanley|title=Acyclic orientations of graphs|journal=Discrete Mathematics|volume=5|issue=2 |pages=171–178|year= 1973|doi=10.1016/0012-365X(73)90108-8|url=http://math.mit.edu/~rstan/pubs/pubfiles/18.pdf}}.</ref>
 +
 
 +
Dependency graphs without circular dependencies form DAGs.
 +
 
 +
无循环依赖关系的依赖图形成 DAGs。
 +
 
 +
 
 +
 
 +
[[File:Graph Condensation.svg|thumb|upright=1.5|The yellow directed acyclic graph is the [[Condensation (graph theory)|condensation]] of the blue directed graph. It is formed by [[Edge contraction|contracting]] each [[strongly connected component]] of the blue graph into a single yellow vertex.]]
 +
 
 +
For instance, when one cell of a spreadsheet changes, it is necessary to recalculate the values of other cells that depend directly or indirectly on the changed cell. For this problem, the tasks to be scheduled are the recalculations of the values of individual cells of the spreadsheet. Dependencies arise when an expression in one cell uses a value from another cell. In such a case, the value that is used must be recalculated earlier than the expression that uses it. Topologically ordering the dependency graph, and using this topological order to schedule the cell updates, allows the whole spreadsheet to be updated with only a single evaluation per cell. Similar problems of task ordering arise in makefiles for program compilation
 +
 
 +
例如,当电子表格的一个单元格发生更改时,必须重新计算直接或间接依赖于更改单元格的其他单元格的值。对于此问题,计划中的任务是对电子表格各单元格的值重新计算。当一个单元格中的表达式使用另一个单元格中的值时,就会出现依赖性。在这种情况下,必须比使用该值的表达式更早地重新计算使用的值。通过拓扑排序依赖关系图,并使用这个拓扑有序表来安排单元格的更新,可以使整个电子表格只需要对每个单元格进行一次计算就可以更新。类似的任务排序问题也出现在程序编译的 makefile 中
 +
 
 +
Any directed graph may be made into a DAG by removing a [[feedback vertex set]] or a [[feedback arc set]], a set of vertices or edges (respectively) that touches all cycles. However, the smallest such set is [[NP-hard]] to find.<ref>{{Garey-Johnson}}, Problems GT7 and GT8, pp.&nbsp;191–192.</ref> An arbitrary directed graph may also be transformed into a DAG, called its [[condensation (graph theory)|condensation]], by [[Edge contraction|contracting]] each of its [[strongly connected component]]s into a single supervertex.<ref>{{citation|title=Structural Models: An Introduction to the Theory of Directed Graphs|last1=Harary|first1=Frank|author1-link=Frank Harary|last2=Norman|first2=Robert Z.|last3=Cartwright|first3=Dorwin|publisher=John Wiley & Sons|year=1965|page=63}}.</ref> When the graph is already acyclic, its smallest feedback vertex sets and feedback arc sets are [[empty set|empty]], and its condensation is the graph itself.
 +
 
 +
 
 +
 
 +
PERT chart for a project with five milestones (labeled 10–50) and six tasks (labeled A–F). There are two critical paths, ADF and BC.
 +
 
 +
有五个里程碑(标记为10-50)和六个任务(标记为 a-f)的项目的 PERT 图表。有两条关键路径,ADF 和 BC。
 +
 
 +
=== Transitive closure and transitive reduction ===
 +
 
 +
A somewhat different DAG-based formulation of scheduling constraints is used by the program evaluation and review technique (PERT), a method for management of large human projects that was one of the first applications of DAGs. In this method, the vertices of a DAG represent milestones of a project rather than specific tasks to be performed. Instead, a task or activity is represented by an edge of a DAG, connecting two milestones that mark the beginning and completion of the task. Each such edge is labeled with an estimate for the amount of time that it will take a team of workers to perform the task. The longest path in this DAG represents the critical path of the project, the one that controls the total time for the project. Individual milestones can be scheduled according to the lengths of the longest paths ending at their vertices.
 +
 
 +
计划评审技术(program evaluation and review technique,PERT)使用了一种略有不同的基于 DAGs 的进度约束形式,这种方法是 DAGs 的首批应用之一,用于管理大型人类项目。在这种方法中,DAG 的顶点代表项目的里程碑,而不是要执行的具体任务。相反,一个任务或活动由一个有向无环图的边缘表示,连接两个标志任务开始和完成的里程碑。每个这样的边都标注了一个估计值,表示一组工作人员执行该任务所需的时间。DAG 中最长的路径代表项目的关键路径,它控制项目的总时间。单个里程碑可以根据在其顶点结束的最长路径的长度进行调度。
 +
 
 +
The transitive closure of a given DAG, with {{mvar|n}} vertices and {{mvar|m}} edges, may be constructed in time {{math|''O''(''mn'')}} by using either [[breadth-first search]] or [[depth-first search]] to test reachability from each vertex.<ref>{{harvtxt|Skiena|2009}}, p. 495.</ref> Alternatively, it can be solved in time {{math|''O''(''n''<sup>''ω''</sup>)}} where {{math|''ω''&nbsp;<&nbsp;2.373}} is the [[Computational complexity of matrix multiplication#Matrix multiplication exponent|exponent for matrix multiplication algorithms]]; this is a theoretical improvement over the {{math|''O''(''mn'')}} bound for [[dense graph]]s.<ref>{{harvtxt|Skiena|2009}}, p. 496.</ref>
 +
 
 +
 
 +
 
 +
In all of these transitive closure algorithms, it is possible to distinguish pairs of vertices that are reachable by at least one path of length two or more from pairs that can only be connected by a length-one path. The transitive reduction consists of the edges that form length-one paths that are the only paths connecting their endpoints. Therefore, the transitive reduction can be constructed in the same asymptotic time bounds as the transitive closure.<ref>{{harvtxt|Bang-Jensen|Gutin|2008}}, p. 38.</ref>
 +
 
 +
A directed acyclic graph may be used to represent a network of processing elements. In this representation, data enters a processing element through its incoming edges and leaves the element through its outgoing edges.
 +
 
 +
有向无环图可以用来表示处理元素的网络。在这种表示法中,数据通过传入边进入处理元素,通过传出边离开元素。
 +
 
 +
 
 +
 
 +
=== Closure problem ===
 +
 
 +
For instance, in electronic circuit design, static combinational logic blocks can be represented as an acyclic system of logic gates that computes a function of an input, where the input and output of the function are represented as individual bits. In general, the output of these blocks cannot be used as the input unless it is captured by a register or state element which maintains its acyclic properties.  Electronic circuit schematics either on paper or in a database are a form of directed acyclic graphs using instances or components to form a directed reference to a lower level component.  Electronic circuits themselves are not necessarily acyclic or directed.
 +
 
 +
例如,在电子电路设计中,静态组合逻辑电路块可以表示为一个逻辑门的非循环系统,计算一个输入函数,其中的输入和输出被表示为单独的位。一般来说,这些块的输出不能用作输入,除非它被保持其非循环属性的寄存器或状态元素捕获。纸上或数据库中的电子电路原理图是一种有向无环图的形式,使用实例或组件形成对较低级别组件的有向引用。电子电路本身不一定是无环或有向的。
 +
 
 +
{{Main|Closure problem}}
 +
 
 +
The [[closure problem]] takes as input a vertex-weighted directed acyclic graph and seeks the minimum (or maximum) weight of a closure – a set of vertices ''C'', such that no edges leave ''C''. The problem may be formulated for directed graphs without the assumption of acyclicity, but with no greater generality, because in this case it is equivalent to the same problem on the condensation of the graph. It may be solved in polynomial time using a reduction to the [[maximum flow problem]].<ref>{{citation
 +
 
 +
Dataflow programming languages describe systems of operations on data streams, and the connections between the outputs of some operations and the inputs of others. These languages can be convenient for describing repetitive data processing tasks, in which the same acyclically-connected collection of operations is applied to many data items. They can be executed as a parallel algorithm in which each operation is performed by a parallel process as soon as another set of inputs becomes available to it.
 +
 
 +
数据流编程语言描述了对数据流的操作系统,以及某些操作的输出和其他操作的输入之间的连接。这些语言可以方便地描述重复的数据处理任务,在这些任务中,对许多数据项应用相同的无环连接的操作集合。它们可以作为一个并行算法执行,其中每个操作在另一组输入可用时由一个并行进程执行。
 +
 
 +
| last = Picard | first = Jean-Claude
 +
 
 +
| doi = 10.1287/mnsc.22.11.1268
 +
 
 +
In compilers, straight line code (that is, sequences of statements without loops or conditional branches) may be represented by a DAG describing the inputs and outputs of each of the arithmetic operations performed within the code. This representation allows the compiler to perform common subexpression elimination efficiently. At a higher level of code organization, the acyclic dependencies principle states that the dependencies between modules or components of a large software system should form a directed acyclic graph.
 +
 
 +
在编译器中,直线代码(即没有循环或条件分支的语句序列)可以由 DAG 表示,DAG 描述代码中执行的每个算术运算的输入和输出。此表示形式允许编译器有效地执行公共子表达式消除。在更高层次的代码组织中,非循环依赖原则指出,大型软件系统的模块或组件之间的依赖应该形成一个有向无环图。
 +
 
 +
| issue = 11
   −
定义:
+
| journal = [[Management Science (journal)|Management Science]]
−
A graph is formed by vertices and by edges connecting pairs of vertices, where the vertices can be any kind of object that is connected in pairs by edges. In the case of a directed graph, each edge has an orientation, from one vertex to another vertex. A path in a directed graph is a sequence of edges having the property that the ending vertex of each edge in the sequence is the same as the starting vertex of the next edge in the sequence; a path forms a cycle if the starting vertex of its first edge equals the ending vertex of its last edge. A directed acyclic graph is a directed graph that has no cycles.[1][2][3]
  −
图(graph)由节点(?)(vertices)和连接成对节点的边(edges)组成, 节点(?)可以是通过边连接的成对的任何类型的对象。有向图(directed graph)的每条边都有方向,从一个节点指向另一个节点。有向图中的路径(path)是一个边序列,该序列中的每条边的结束节点 是该序列中下一条边的开始节点。如果序列的第一条边的开始节点是最后一条边的结束节点,则路径形成环。有向无环图是没有环的有向图。[1][2][3]
     −
A vertex v of a directed graph is said to be reachable from another vertex u when there exists a path that starts at u and ends at v. As a special case, every vertex is considered to be reachable from itself (by a path with zero edges). If a vertex can reach itself via a nontrivial path (a path with one or more edges), then that path is a cycle, so another way to define directed acyclic graphs is that they are the graphs in which no vertex can reach itself via a nontrivial path.[4]
+
Feedforward neural networks are another example.
−
当存在一条从节点u到节点v的路径时, 有向图的节点v 被称为从节点u可达的(reachable)。特别地,每一个节点都被认为从自身可达(通过一条没有边的路径)。如果节点可以通过一条nontrivial(?)路径(有一条或多条边的路径)到达自身,则该路径是环(cycle)。因此可以通过另一种方式定义,有向无环图是没有节点能够通过nontrivial (?)路径到达自身的图。[4]
     −
数学性质
+
前馈神经网络是另一个例子。
−
可达性(reachability), transitive closure, 和 transitve reduction
  −
任何有向无环图中的可达性(reachability)关系可以形式化为DAG中节点的 偏序≤  。 在该偏序中,当DAG中存在从节点u到节点v的有向路径时,节点u和节点v被排序为u ≤ v。也就是,从节点u是可达节点v。[5] 然而,不同的DAG 可能相同的可达性关系和相同的偏序[6]。例如,
      +
| mr = 0403596
   −
The reachability relationship in any directed acyclic graph can be formalized as a partial order ≤ on the vertices of the DAG. In this partial order, two vertices u and v are ordered as u ≤ v exactly when there exists a directed path from u to v in the DAG; that is, when v is reachable from u.[5] However, different DAGs may give rise to the same reachability relation and the same partial order.[6] For example, the DAG with two edges a → b and b → c has the same reachability relation as the graph with three edges a → b, b → c, and a → c. Both of these DAGS produce the same partial order, in which the vertices are ordered as a ≤ b ≤ c.有
+
| pages = 1268–1272
−
向无环图的可达性可以用其顶点的偏序关系≤来表示。在偏序关系中,如果存在一条路径从顶点u指向顶点v,它们的偏序关系可被写作u ≤ v。这也被称作v是从u可达的。[6]不同的有向无环图可以有着相同的可达关系和偏序关系。[7]例如,有两条边a → b,b → c的有向无环图,和有三条边的a → b, b → c,a → c的有向无环图有着相同的偏序关系a ≤ b ≤ c。
     −
If G is a DAG, its transitive closure is the graph with the most edges that represents the same reachability relation. It has an edge u → v whenever u can reach v. That is, it has an edge for every related pair u ≤ v of distinct elements in the reachability relation of G, and may therefore be thought of as a direct translation of the reachability relation ≤ into graph-theoretic terms.
+
| title = Maximal closure of a graph and applications to combinatorial problems
−
The same method of translating partial orders into DAGs works more generally: for every finite partially ordered set (S, ≤), the graph that has a vertex for each member of S and an edge for each pair of elements related by u ≤ v is automatically a transitively closed DAG,
  −
and has (S, ≤) as its reachability relation. In this way, every finite partially ordered set can be represented as the reachability relation of a DAG.
  −
对于一个有向无环图G,它的传递闭包等同于一个在保持与其相同可达性的情况下,边数最多的图。在这个图中,当u可达v的时候,边u → v必定存在。换句话说,每个G中的非相同元素偏序关系对u ≤ v都在这个图中有一条边。因此可以视为 可达性关系≤直接转化成图论术语。
  −
把偏序转化成有向无环图 的同样方法更加一般化:<font color="#32cd32"> 对于每个有限偏序集 (S, ≤),对于S的每个元素都有一个顶点,被u ≤ v 连接的每一对元素都有一条边,这样的图自动成为转化封闭的有向无环图,这样的图有(S, ≤)作为可达性关系。</font>以这种方式,每个有限偏序集合可以表示为有向无环图的可达性关系。
  −
The transitive reduction of a DAG G is the graph with the fewest edges that represents the same reachability relation as G. It is a subgraph of G, formed by discarding the edges u → v for which G also contains a longer path connecting the same two vertices. Like the transitive closure, the transitive reduction is uniquely defined for DAGs. In contrast, for a directed graph that is not acyclic, there can be more than one minimal subgraph with the same reachability relation.[7]
  −
有向无环图G的<font color="#ff8000"> 传递规约Transitive reduction</font>为和其有着相同可达性,边数最少的图。它是G的一个子图。构造方法为当G有着一条更长的路径连接顶点u和v的时候,消去边u → v。 传递归约和传递闭包都是有向无环图的特有概念。相反的,对于有向有环图,可以存在多个与原图有着相同可达性的最简子图。[7]
  −
If a DAG G has a reachability relation described by the partial order ≤, then the transitive reduction of G is a subgraph of G that has an edge u → v for every pair in the covering relation of ≤.
     −
  Transitive reductions are useful in visualizing the partial orders they represent, because they have fewer edges than other graphs representing the same orders and therefore lead to simpler graph drawings. A Hasse diagram of a partial order is a drawing of the transitive reduction in which the orientation of each edge is shown by placing the starting vertex of the edge in a lower position than its ending vertex.[8]
+
  | volume = 22
−
对于有向无环图G和表达其可达性的偏序关系≤,它的传递规约也可以看作包含G的<font color="#ff8000"> 覆盖关系Covering relation</font>中每一条边的G的子图。传递规约在可视化有向无环图的偏序关系时十分有用,因为它们比其他具有相同偏序关系的图的边数要少,这简化了绘图。偏序关系的<font color="#ff8000"> 哈斯图Hasse diagram </font>由将传递归约中的每条边的起点绘制在其终点的下方而得到。[8]
     −
Topological ordering
+
Graphs in which vertices represent events occurring at a definite time, and where the edges are always point from the early time vertex to a late time vertex of the edge, are necessarily directed and acyclic. The lack of a cycle follows because the time associated with a vertex always increases as you follow any path in the graph so you can never return to a vertex on a path.  This reflects our natural intuition that causality means events can only affect the future, they never affect the past, and thus we have no causal loops. An example of this type of directed acyclic graph are those encountered in the causal set approach to quantum gravity though in this case the graphs considered are transitively complete. In the version history example, each version of the software is associated with a unique time, typically the time the version was saved, committed or released. For citation graphs, the documents are published at one time and can only refer to older documents.
−
拓扑排序
  −
A topological ordering of a directed graph is an ordering of its vertices into a sequence, such that for every edge the start vertex of the edge occurs earlier in the sequence than the ending vertex of the edge.  
  −
A graph that has a topological ordering cannot have any cycles, because the edge into the earliest vertex of a cycle would have to be oriented the wrong way. Therefore, every graph with a topological ordering is acyclic. Conversely, every directed acyclic graph has at least one topological ordering. The existence of a topological ordering can therefore be used as an equivalent definition of a directed acyclic graphs: they are exactly the graphs that have topological orderings.[2]
     −
In general, this ordering is not unique; a DAG has a unique topological ordering if and only if it has a directed path containing all the vertices, in which case the ordering is the same as the order in which the vertices appear in the path.[9]
+
顶点表示在一定时间内发生的事件,并且边始终是从边的早期时间顶点到后期时间顶点的点的图,必然是有向的和无环的。没有循环是因为当你沿着图中的任何一条路径走时,与一个顶点相关的时间总是增加,所以你永远不能返回到路径上的一个顶点。这反映了我们的自然直觉,因果关系意味着事件只能影响未来,它们从不影响过去,因此我们没有因果循环。这类有向无环图的一个例子是在量子引力的因果集方法中遇到的,尽管在这种情况下所考虑的图是传递完全的。在版本历史示例中,软件的每个版本都与一个唯一的时间相关联,通常是保存、提交或发布版本的时间。对于引用图,这些文献只能发表一次,并且只能引用较早的文献。
−
有向无环图的<font color="#ff8000"> 拓扑排序Topological ordering</font>为  <font color="#32cd32"> 为所有边的起点都出现在其终点之前的排序。</font>
  −
能构成拓扑排序的图一定没有环,因为环中的一条边必定从排序较后的顶点指向比其排序更前的顶点。
  −
基于此,拓扑排序可以被用来定义有向无环图:当且仅当一个有向图有拓扑排序,它是有向无环图。[2]
  −
一般情况下,拓扑排序并非唯一。有向无环图仅仅在存在一条路径可以包含其所有顶点的情况下,有唯一的拓扑排序方式,这时,拓扑排序与它们在这条路径中出现的顺序相同。[9]
     −
The family of topological orderings of a DAG is the same as the family of linear extensions of the reachability relation for the DAG,[10] so any two graphs representing the same partial order have the same set of topological orders.
+
| year = 1976}}.</ref>
−
有向无环图的拓扑排序族等同于其可达性的<font color="#ff8000"> 线性拓展Linear extension
+
 
−
</font>族。 [10]因此,偏序关系相同的任意两个图会有相同的拓扑排序集。
+
 
 +
 
 +
Sometimes events are not associated with a specific physical time.  Provided that pairs of events have a purely causal relationship, that is edges represent causal relations between the events, we will have a directed acyclic graph. For instance, a Bayesian network represents a system of probabilistic events as vertices in a directed acyclic graph, in which the likelihood of an event may be calculated from the likelihoods of its predecessors in the DAG. In this context, the moral graph of a DAG is the undirected graph created by adding an (undirected) edge between all parents of the same vertex (sometimes called marrying), and then replacing all directed edges by undirected edges. Another type of graph with a similar causal structure is an influence diagram, the vertices of which represent either decisions to be made or unknown information, and the edges of which represent causal influences from one vertex to another. In epidemiology, for instance, these diagrams are often used to estimate the expected value of different choices for intervention.
 +
 
 +
有时,事件与特定的物理时间无关。如果成对的事件具有纯粹的因果关系,即边缘代表事件之间的因果关系,那么我们就有了一个有向无环图。例如,一个贝氏网路代表一个概率事件系统作为一个有向无环图中的顶点,在这个顶点中,一个事件的可能性可以通过它在 DAG 中的前身的可能性来计算。在这种情况下,有向无环图是在同一顶点的所有父母之间加上一条(无向)边(有时称为结合) ,然后用无向边代替所有有向边而产生的无向图。另一种具有类似因果结构的图类型是影响图,其顶点表示要作出的决定或未知信息,其边表示从一个顶点到另一个顶点的因果影响。例如,在流行病学中,这些图表通常用于估计不同干预选择的期望值。
 +
 
 +
=== Path algorithms ===
 +
 
 +
Some algorithms become simpler when used on DAGs instead of general graphs, based on the principle of topological ordering. For example, it is possible to find [[shortest path]]s and [[longest path problem|longest paths]] from a given starting vertex in DAGs in linear time by [[Topological sorting#Application to shortest path finding|processing the vertices in a topological order]], and calculating the path length for each vertex to be the minimum or maximum length obtained via any of its incoming edges.<ref>Cormen et al. 2001, Section 24.2, Single-source shortest paths in directed acyclic graphs, pp. 592–595.</ref> In contrast, for arbitrary graphs the shortest path may require slower algorithms such as [[Dijkstra's algorithm]] or the [[Bellman–Ford algorithm]],<ref>Cormen et al. 2001, Sections 24.1, The Bellman–Ford algorithm, pp. 588–592, and 24.3, Dijkstra's algorithm, pp. 595–601.</ref> and longest paths in arbitrary graphs are [[NP-hard]] to find.<ref>Cormen et al. 2001, p. 966.</ref>
 +
 
 +
The converse is also true.  That is in any application represented by a directed acyclic graph there is a causal structure, either an explicit order or time in the example or an order which can be derived from graph structure. This follows because all directed acyclic graphs have a topological ordering, i.e. there is at least one way to put the vertices in an order such that all edges point in the same direction along that order.
 +
 
 +
反之亦然。也就是说,在任何用有向无环图表示的应用程序中,都存在一个因果结构,要么是例子中显式的顺序或时间,要么是可以从图结构中派生出来的顺序。这是因为所有有向无圈图都有一个拓扑序,即。至少有一种方法可以将顶点按顺序排列,使所有边沿着这个顺序指向同一个方向。
 +
 
 +
== Applications ==
 +
 
 +
 
 +
 
 +
Family tree of the [[Ptolemaic dynasty, with many marriages between close relatives causing pedigree collapse]]
 +
 
 +
托勒密王朝的家谱,许多近亲之间的婚姻导致家谱崩溃
 +
 
 +
=== Scheduling ===
 +
 
 +
Family trees may be seen as directed acyclic graphs, with a vertex for each family member and an edge for each parent-child relationship. Despite the name, these graphs are not necessarily trees because of the possibility of marriages between relatives (so a child has a common ancestor on both the mother's and father's side) causing pedigree collapse. The graphs of matrilineal descent ("mother" relationships between women) and patrilineal descent ("father" relationships between men) are trees within this graph.  Because
 +
 
 +
家族树可以看作是有向无圈图,每个家族成员有一个顶点,每个亲子关系有一条边。除了名字,这些图并不一定是树,因为亲戚之间的婚姻(所以一个孩子在母亲和父亲方面有一个共同的祖先)会导致家谱崩溃。母系血统(女性之间的“母亲”关系)和父系血统(男性之间的“父亲”关系)的图表就是这个图表中的树。因为
 +
 
 +
Directed acyclic graphs representations of partial orderings have many applications in [[Schedule|scheduling]] for systems of tasks with ordering constraints.<ref>{{harvtxt|Skiena|2009}}, p. 469.</ref>
 +
 
 +
no one can become their own ancestor, family trees are acyclic.
 +
 
 +
没有人能成为自己的祖先,家谱是无环的。
 +
 
 +
An important class of problems of this type concern collections of objects that need to be updated, such as the cells of a [[spreadsheet]] after one of the cells has been changed, or the [[object file]]s of a piece of computer software after its [[source code]] has been changed.
 +
 
 +
In this context, a [[dependency graph]] is a graph that has a vertex for each object to be updated, and an edge connecting two objects whenever one of them needs to be updated earlier than the other. A cycle in this graph is called a [[circular dependency]], and is generally not allowed, because there would be no way to consistently schedule the tasks involved in the cycle.
 +
 
 +
The version history of a distributed revision control system, such as Git, generally has the structure of a directed acyclic graph, in which there is a vertex for each revision and an edge connecting pairs of revisions that were directly derived from each other. These are not trees in general due to merges.
 +
 
 +
分散式版本控制版本的历史,比如 Git,通常有一个有向无环图版本的结构,每个版本都有一个顶点,一条边连接直接从其他版本派生出来的修订对。由于合并,这些通常不是树。
 +
 
 +
Dependency graphs without circular dependencies form DAGs.<ref>{{citation | last1=Al-Mutawa | first1=H. A. | last2=Dietrich | first2=J. | last3=Marsland | first3=S. | last4=McCartin | first4=C. | contribution=On the shape of circular dependencies in Java programs | doi=10.1109/ASWEC.2014.15 | pages=48–57 | publisher=IEEE | title=23rd Australian Software Engineering Conference | year=2014| isbn=978-1-4799-3149-1 | s2cid=17570052 }}.</ref>
 +
 
 +
 
 +
 
 +
In many randomized algorithms in computational geometry, the algorithm maintains a history DAG representing the version history of a geometric structure over the course of a sequence of changes to the structure. For instance in a randomized incremental algorithm for Delaunay triangulation, the triangulation changes by replacing one triangle by three smaller triangles when each point is added, and by "flip" operations that replace pairs of triangles by a different pair of triangles. The history DAG for this algorithm has a vertex for each triangle constructed as part of the algorithm, and edges from each triangle to the two or three other triangles that replace it. This structure allows point location queries to be answered efficiently: to find the location of a query point  in the Delaunay triangulation, follow a path in the history DAG, at each step moving to the replacement triangle that contains . The final triangle reached in this path must be the Delaunay triangle that contains .
 +
 
 +
在计算几何的许多随机算法中,该算法维护一个历史 DAG,它表示一个几何结构在一系列结构变化过程中的版本历史。例如,在一个随机增量的三角形算法中,每增加一个点,三角形就被三个更小的三角形替换,或者用一对不同的三角形“翻转”操作替换成对的三角形,从而改变了三角形德劳内三角化。该算法的历史 DAG 包含每个三角形的顶点,以及每个三角形到其他两三个三角形的边。这种结构允许有效地回答点位置查询: 要在德劳内三角化中找到查询点的位置,按照历史 DAG 中的路径,在每一步移动到包含的替换三角形。在这条路径中达到的最后一个三角形必须是包含。
 +
 
 +
For instance, when one cell of a [[spreadsheet]] changes, it is necessary to recalculate the values of other cells that depend directly or indirectly on the changed cell. For this problem, the tasks to be scheduled are the recalculations of the values of individual cells of the spreadsheet. Dependencies arise when an expression in one cell uses a value from another cell. In such a case, the value that is used must be recalculated earlier than the expression that uses it. Topologically ordering the dependency graph, and using this topological order to schedule the cell updates, allows the whole spreadsheet to be updated with only a single evaluation per cell.<ref name="hgt1181">{{citation |title=Handbook of Graph Theory |first1=Jonathan L. |last1=Gross |first2=Jay |last2=Yellen |first3=Ping |last3=Zhang  | author3-link = Ping Zhang (graph theorist)|edition=2nd |publisher=CRC Press |year=2013 |isbn=978-1-4398-8018-0 |page=1181 |url=https://books.google.com/books?id=cntcAgAAQBAJ&pg=PA1181}}.</ref> Similar problems of task ordering arise in [[makefile]]s for program compilation<ref name="hgt1181" /> and [[instruction scheduling]] for low-level computer program optimization.<ref>{{citation |title=The Compiler Design Handbook: Optimizations and Machine Code Generation |first1=Y. N. |last1=Srikant |first2=Priti |last2=Shankar |edition=2nd |publisher=CRC Press|year=2007 |isbn=978-1-4200-4383-9 |pages=19–39 |url=https://books.google.com/books?id=1kqAv-uDEPEC&pg=SA19-PA39}}.</ref>
   −
Combinatorial enumeration
  −
The graph enumeration problem of counting directed acyclic graphs was studied by Robinson (1973).[11] The number of DAGs on n labeled vertices, for n = 0, 1, 2, 3, … (without restrictions on the order in which these numbers appear in a topological ordering of the DAG) is
  −
1, 1, 3, 25, 543, 29281, 3781503, … (sequence A003024 in the OEIS).
  −
These numbers may be computed by the recurrence relation
  −
[11]
  −
Eric W. Weisstein conjectured,[12] and McKay et al. (2004) proved, that the same numbers count the (0,1) matrices for which all eigenvalues are positive real numbers. The proof is bijective: a matrix A is an adjacency matrix of a DAG if and only if A + I is a (0,1) matrix with all eigenvalues positive, where I denotes the identity matrix. Because a DAG cannot have self-loops, its adjacency matrix must have a zero diagonal, so adding I preserves the property that all matrix coefficients are 0 or 1.[13]
  −
组合计数
  −
<font color="#ff8000"> 罗宾逊 Robinson</font>(1973)研究了有向无环图的<font color="#ff8000"> 图计数Graph enumeration</font>问题。[12] 对于n = 0, 1, 2, 3, …(<font color="#32cd32"> 出现在有向无环图的拓扑排序的这些数字的序列没有限制</font>)的n个标记的顶点的有向无环图的数量是1, 1, 3, 25, 543, 29281, 3781503, … (OEIS中的数列A003024)。
  −
这个数列的<font color="#ff8000"> 递推关系式 Recurrence relation</font>是
  −
[12]
  −
<font color="#ff8000"> 埃里克·韦斯坦因 Eric W. Weisstein</font>推测[13],n个顶点的标号有向无环图的数量与其中所有特征值都为正实数的n*n逻辑矩阵的数量相同。这一点随后被<font color="#ff8000"> McKay</font> et al. (2004) 证实,证明采用了<font color="#ff8000"> 双射法Bijective</font>:一个矩阵A是有向无环图的一个<font color="#ff8000"> 邻接矩阵Adjacency matrix</font>,当且仅当A + I 是一个所有特征值都为正数的逻辑矩阵,其中I 为<font color="#ff8000"> 单位矩阵 Identity matrix</font>。因为一个有向无环图不允许<font color="#ff8000"> 自环Self-loops</font>,它的邻接矩阵的对角线必定全为0。因此,加上I 保持了所有矩阵因子都是0或1的特性。[13]
  −
Related families of graphs
  −
相关概念
        −
A polytree is a directed graph formed by orienting the edges of a free tree.[14] Every polytree is a DAG. In particular, this is true of the arborescences formed by directing all edges outwards from the roots of a tree.
+
[[File:Pert chart colored.svg|thumb|PERT chart for a project with five milestones (labeled 10–50) and six tasks (labeled A–F). There are two critical paths, ADF and BC.]]
−
<font color="#ff8000"> 多重树Polytree</font>由将<font color="#ff8000"> 自由树 Free tree</font>的边<font color="#ff8000"> 定向Orienting</font>而得到。[14] 多重树必定是有向无环图。对于有根树,将其所有边赋予指离根的方向也可以得到有向无环图,即<font color="#ff8000"> 树状图Arborescences </font>。
     −
A multitree (also called a strongly unambiguous graph or a mangrove) is a directed graph in which there is at most one directed path (in either direction) between any two vertices; equivalently, it is a DAG in which, for every vertex v, the subgraph reachable from v forms a tree.[15]
+
In a citation graph the vertices are documents with a single publication date. The edges represent the citations from the bibliography of one document to other necessarily earlier documents. The classic example comes from the citations between academic papers as pointed out in the 1965 article "Networks of Scientific Papers" by Derek J. de Solla Price who went on to produce the first model of a citation network, the Price model. In this case the citation count of a paper is just the in-degree of the corresponding vertex of the citation network. This is an important measure in citation analysis. Court judgements provide another example as judges support their conclusions in one case by recalling other earlier decisions made in previous cases. A final example is provided by patents which must refer to earlier prior art, earlier patents which are relevant to the current patent claim. By taking the special properties of directed acyclic graphs into account, one can analyse citation networks with techniques not available when analysing the general graphs considered in many studies using network analysis. For instance transitive reduction gives a new insights into the citation distributions found in different applications highlighting clear differences in the mechanisms creating citations networks in different contexts. Another technique is main path analysis, which traces the citation links and suggests the most significant citation chains in a given citation graph.
−
<font color="#ff8000"> 强明确树Multitree</font>是每两个顶点最多被一条路径所连接的有向无环图。等价的说,它是满足以下性质的一个有向无环图:对于图中每个顶点v,从v可达的顶点组成一颗树。[15]
     −
==============================
+
在引用图中,顶点是只有一个出版日期的文档。边代表从一个文档的参考书目到其他必要的早期文档的引用。经典的例子来自于学术论文之间的引用,正如1965年德瑞克·约翰·德索拉·普莱斯在《科学论文网络》一文中指出的那样,他继续创造了引用网络的第一个模型---- 价格模型。在这种情况下,一篇论文的引文数量就是引文网络相应顶点的度数。这是21引文分析的一项重要措施。法院判决提供了另一个例子,因为法官通过回顾以前案件中作出的其他判决来支持他们在一个案件中的结论。最后一个例子是专利,必须提到先前的技术,先前的专利,这是有关当前的专利权利主张。通过考虑有向无环图的特殊性质,可以利用网络分析方法分析引文网络。例如,传递减法对不同应用中的引用分布提供了新的见解,突出了不同上下文中引用网络形成机制的明显差异。另一种技术是主路径分析,它跟踪引文链接,并提出给定引文图中最重要的引文链。
−
Computational problems
  −
相关计算问题
  −
Topological sorting and recognition
  −
拓扑排序和识别
     −
Topological sorting is the algorithmic problem of finding a topological ordering of a given DAG. It can be solved in linear time.[16] Kahn's algorithm for topological sorting builds the vertex ordering directly. It maintains a list of vertices that have no incoming edges from other vertices that have not already been included in the partially constructed topological ordering; initially this list consists of the vertices with no incoming edges at all. Then, it repeatedly adds one vertex from this list to the end of the partially constructed topological ordering, and checks whether its neighbors should be added to the list. The algorithm terminates when all vertices have been processed in this way.[17] Alternatively, a topological ordering may be constructed by reversing a postorder numbering of a depth-first search graph traversal.[16]
+
A somewhat different DAG-based formulation of scheduling constraints is used by the [[program evaluation and review technique]] (PERT), a method for management of large human projects that was one of the first applications of DAGs. In this method, the vertices of a DAG represent [[Milestone (project management)|milestones]] of a project rather than specific tasks to be performed. Instead, a task or activity is represented by an edge of a DAG, connecting two milestones that mark the beginning and completion of the task. Each such edge is labeled with an estimate for the amount of time that it will take a team of workers to perform the task. The [[Longest path problem|longest path]] in this DAG represents the [[Critical path method|critical path]] of the project, the one that controls the total time for the project. Individual milestones can be scheduled according to the lengths of the longest paths ending at their vertices.<ref>{{citation |title=What Every Engineer Should Know About Decision Making Under Uncertainty |first=John X. |last=Wang |publisher=CRC Press |year=2002 |isbn=978-0-8247-4373-4 |page=160 |url=https://books.google.com/books?id=C3yKML0dUVIC&pg=PA160}}.</ref>
   −
可以用<font color="#ff8000"> 线性时间复杂度Linear
  −
time</font>的卡恩算法来找到一个有向无环图的拓扑排序。[16]简单来说,开设一个存放结果的列表L,先将入度为零的节点放到L中,因为这些节点没有任何的父节点。将与这些节点相连的边从图中去掉,再寻找图中入度为零的节点。对于新找到的节点来说,他们的父节点已经都在L中了,所以也可以从末端插入L。重复上述操作,直到找不到入度为零的节点。[18] 另外一种构造拓扑排序的算法是将<font color="#ff8000"> 深度优先搜索 Depth-first</font>的<font color="#ff8000"> 后序遍历Postorder</font>结果翻转。[17]
  −
It is also possible to check whether a given directed graph is a DAG in linear time, either by attempting to find a topological ordering and then testing for each edge whether the resulting ordering is valid[18] or alternatively, for some topological sorting algorithms, by verifying that the algorithm successfully orders all the vertices without meeting an error condition.[17]
  −
检查一个有向图是否为有向无环图亦可在线性时间内完成。一种方法是先找到一个拓扑排序,然后测试这个排序是否能符合图中每条边所连顶点在排序中应该出现的顺序。[19] 对于卡恩算法在内的部分拓扑排序算法,通过在算法终止时判断是否满足一定条件即可知道图是否有环。[18]如果有环,卡恩算法最终获得的L中节点个数会与图的节点总数不同。
     −
Construction from cyclic graphs
  −
Any undirected graph may be made into a DAG by choosing a total order for its vertices and directing every edge from the earlier endpoint in the order to the later endpoint. The resulting orientation of the edges is called an acyclic orientation. Different total orders may lead to the same acyclic orientation, so an n-vertex graph can have fewer than n! acyclic orientations. The number of acyclic orientations is equal to |χ(−1)|, where χ is the chromatic polynomial of the given graph.[19]
  −
从其他图构建
  −
任意无向图都可以被转化为有向无环图。构造方法是选定一个顶点的全序关系,并将无向图中所有边从全序关系中较前的顶点指向较后的顶点。这种方法是定向(英语:Orientation (graph theory))方法中的无环定向(英语:acyclic orientation)。不同的全序关系可能推出相同的无环定向,因此一个包含n个顶点的图的无环定向数量小于n!。如果定义χ为给定图的色多项式,无环定向数量等于|χ(−1)|。[20]
  −
Any directed graph may be made into a DAG by removing a feedback vertex set or a feedback arc set, a set of vertices or edges (respectively) that touches all cycles. However, the smallest such set is NP-hard to find.[20] An arbitrary directed graph may also be transformed into a DAG, called its condensation, by contracting each of its strongly connected components into a single supervertex.[21] When the graph is already acyclic, its smallest feedback vertex sets and feedback arc sets are empty, and its condensation is the graph itself.
  −
任意有环有向图都可以被转化为有向无环图。只要从图中移除反馈节点集(英语:feedback vertex set)或反馈边集(英语:feedback arc set),即对于图中每个环,至少包括环中一个顶点或边的集合。不过,找到反馈节点或边的最小集合是NP困难问题。[21] 另外一种方法将有环有向图去环的方法是将每个强连通分量收缩为一个顶点。[22] 对于无环图,它的最小反馈顶点或边集为空集,它的强连通分量则为自身。
     −
Transitive closure and transitive reduction
+
The Price model is too simple to be a realistic model of a citation network but it is simple enough to allow for analytic solutions for some of its properties. Many of these can be found by using results derived from the undirected version of the Price model, the Barabási–Albert model. However, since Price's model gives a directed acyclic graph, it is a useful model when looking for analytic calculations of properties unique to directed acyclic graphs. For instance,
−
The transitive closure of a given DAG, with n vertices and m edges, may be constructed in time O(mn) by using either breadth-first search or depth-first search to test reachability from each vertex.[22] Alternatively, it can be solved in time O(nω) where ω < 2.373 is the exponent for matrix multiplication algorithms; this is a theoretical improvement over the O(mn) bound for dense graphs.[23]
  −
传递闭包和传递约简
  −
有向无环图的传递闭包可以通过广度优先搜索或深度优先搜索对每个节点测试可达性来构建。算法对于一个有着n个顶点和m条边的有向无环图的复杂度为O(mn)。[23]也可以使用矩阵乘法算法(英语:matrix multiplication algorithm)中最快的Coppersmith–Winograd算法(英语:Coppersmith–Winograd algorithm),其复杂度为O(n2.3728639)。这个算法理论上在稠密图(英语:dense graph)中快过O(mn)。[24]
     −
In all of these transitive closure algorithms, it is possible to distinguish pairs of vertices that are reachable by at least one path of length two or more from pairs that can only be connected by a length-one path. The transitive reduction consists of the edges that form length-one paths that are the only paths connecting their endpoints. Therefore, the transitive reduction can be constructed in the same asymptotic time bounds as the transitive closure.[24]
+
普莱斯模型过于简单,不可能成为引文网络的现实模型,但它足够简单,可以为其某些属性提供分析解。其中许多问题可以通过使用从价格模型(Barabási-Albert 模型)的无向版本得出的结果来找到。然而,由于 Price 的模型给出了一个有向无环图,所以在寻找有向无圈图所特有的性质的解析计算时,它是一个很有用的模型。比如说,
−
不论在哪种传递闭包算法中,那些被一条长度至少为2的路径所连接的顶点对,都可以和只有一条长度为1的路径所连接的顶点对区分开。由于传递约简包含后者,传递约简可以在和传递闭包相同的渐进时间复杂度(英语:Asymptotic computational complexity)中被构建。[25]
  −
Closure problem
  −
Main article: Closure problem
  −
The closure problem takes as input a vertex-weighted directed acyclic graph and seeks the minimum (or maximum) weight of a closure – a set of vertices C, such that no edges leave C. The problem may be formulated for directed graphs without the assumption of acyclicity, but with no greater generality, because in this case it is equivalent to the same problem on the condensation of the graph. It may be solved in polynomial time using a reduction to the maximum flow problem.[25]
  −
闭包问题
  −
闭包是一个图中没有出边的顶点子集,即不存在从子集中顶点指向子集外顶点的边。闭包问题(英语:closure problem)是则是找到带权图中使得权之和最大或最小的子集。闭包问题可以看作最大流问题的简化版,在多项式时间内被解决。实际上,是否有环对于找到闭包没有影响。[26]
     −
Path algorithms
+
=== Data processing networks ===
−
Some algorithms become simpler when used on DAGs instead of general graphs, based on the principle of topological ordering. For example, it is possible to find shortest paths and longest paths from a given starting vertex in DAGs in linear time by processing the vertices in a topological order, and calculating the path length for each vertex to be the minimum or maximum length obtained via any of its incoming edges.[26] In contrast, for arbitrary graphs the shortest path may require slower algorithms such as Dijkstra's algorithm or the Bellman–Ford algorithm,[27] and longest paths in arbitrary graphs are NP-hard to find.[28]
  −
最短或最长路径问题
  −
基于拓扑排序的性质,有向无环图的最短路问题和最长路径问题可以在线性时间内解决。将顶点拓扑排序后,从前到后遍历每一个顶点,对于遍历到的顶点,更新其所有出边所到达顶点的长度值。如果求最短路,则在本边是更短路径的一部分时更新。求最长路则反之。[27]对于非有向无环图,最短路需要用复杂度为
  −
的戴克斯特拉算法或
  −
的贝尔曼-福特算法等。[28]最长路径则是一个NP困难问题。[29]
     −
Applications
+
the length of the longest path, from the n-th node added to the network to the first node in the network, scales as <math>\ln(n)</math>.
−
Scheduling
  −
Directed acyclic graphs representations of partial orderings have many applications in scheduling for systems of tasks with ordering constraints.[29] An important class of problems of this type concern collections of objects that need to be updated, such as the cells of a spreadsheet after one of the cells has been changed, or the object files of a piece of computer software after its source code has been changed. In this context, a dependency graph is a graph that has a vertex for each object to be updated, and an edge connecting two objects whenever one of them needs to be updated earlier than the other. A cycle in this graph is called a circular dependency, and is generally not allowed, because there would be no way to consistently schedule the tasks involved in the cycle. Dependency graphs without circular dependencies form DAGs.[30]
  −
应用
  −
调度
  −
有向无环图的偏序关系可以在调度有着先后顺序限制的系统任务中发挥作用。[30]调度问题的一个重要种类是串联需要更新的对象,如電子試算表中某个单元格的计算公式依赖于其他单元格,或在程序的源代码被修改后重新编译目标文件。依赖图(英语:dependency graph)则记录了这种更新依赖关系。其每个顶点对应一个需要被更新的对象,边则表示更新的关系。依赖图中的环被称为环状依赖(英语:circular dependency)。环状依赖通常是不被允许出现的,因为不能保证圈内任务排定顺序的一致性。无环的依赖图即为有向无环图。[31]
     −
For instance, when one cell of a spreadsheet changes, it is necessary to recalculate the values of other cells that depend directly or indirectly on the changed cell. For this problem, the tasks to be scheduled are the recalculations of the values of individual cells of the spreadsheet. Dependencies arise when an expression in one cell uses a value from another cell. In such a case, the value that is used must be recalculated earlier than the expression that uses it. Topologically ordering the dependency graph, and using this topological order to schedule the cell updates, allows the whole spreadsheet to be updated with only a single evaluation per cell.[31] Similar problems of task ordering arise in makefiles for program compilation[31] and instruction scheduling for low-level computer program optimization.[32]
+
最长路径的长度,从添加到网络的第 n 个节点到网络中的第一个节点,缩放为 < math > ln (n) </math > 。
−
举例来说,当电子表格中一个单元格的数值发生改变,其他直接或间接依赖于该单元格的所有单元格的值都需要被重新计算。被调度的任务为重新计算某个特定单元格的值。当一个单元格的值取决于另外一个单元格时,两个单元格之间则有依赖关系。每个被依赖单元格的值的计算过程都必须先于使用它的表达式执行。使用依赖图的拓扑排序来调度任务使得在每个单元格的值都仅被重新计算一次的情况下,整个工作表都能被更新。[32]相似的任务调度场景出现在程序源代码编译的makefile,[32]和优化计算机程序底层执行的指令调度中。[33]
     −
A somewhat different DAG-based formulation of scheduling constraints is used by the program evaluation and review technique (PERT), a method for management of large human projects that was one of the first applications of DAGs. In this method, the vertices of a DAG represent milestones of a project rather than specific tasks to be performed. Instead, a task or activity is represented by an edge of a DAG, connecting two milestones that mark the beginning and completion of the task. Each such edge is labeled with an estimate for the amount of time that it will take a team of workers to perform the task. The longest path in this DAG represents the critical path of the project, the one that controls the total time for the project. Individual milestones can be scheduled according to the lengths of the longest paths ending at their vertices.[33]
  −
计划评审技术是一种基于有向无环图的计划排定技术,通常用于组织大型的人工项目。在计划评审技术中,每个顶点表示项目的一个里程碑(英语:Milestone (project management)),每条有向边表示任务或者活动,连接着表示任务开始或结束的两个节点。每条边则被标注上预估需时。图中的最长路径即为项目的关键路径。关键路径决定了项目所需的总时间,里程碑的完成时间取决于结束于本顶点的最长路径。[34]
  −
Data processing networks
   
A directed acyclic graph may be used to represent a network of processing elements. In this representation, data enters a processing element through its incoming edges and leaves the element through its outgoing edges.
 
A directed acyclic graph may be used to represent a network of processing elements. In this representation, data enters a processing element through its incoming edges and leaves the element through its outgoing edges.
−
数据处理网络
  −
有向无环图可以用于表示处理数据的元素网络。在网络中,数据从一个元素顶点的入边进入,处理后从出边离开。
     −
For instance, in electronic circuit design, static combinational logic blocks can be represented as an acyclic system of logic gates that computes a function of an input, where the input and output of the function are represented as individual bits. In general, the output of these blocks cannot be used as the input unless it is captured by a register or state element which maintains its acyclic properties.[34] Electronic circuit schematics either on paper or in a database are a form of directed acyclic graphs using instances or components to form a directed reference to a lower level component. Electronic circuits themselves are not necessarily acyclic or directed.
  −
在电子电路设计中,静态组合逻辑电路块可以被表示为由邏輯閘组成的有向无环系统。每个逻辑门对输入做一次函数处理,输入和输出均为一个位元组。通常,这些电路块的输出不能够再作为输入,除非它们被存储在寄存器或者状态单元中,以保证图不出现环。[35]
  −
Dataflow programming languages describe systems of operations on data streams, and the connections between the outputs of some operations and the inputs of others. These languages can be convenient for describing repetitive data processing tasks, in which the same acyclically-connected collection of operations is applied to many data items. They can be executed as a parallel algorithm in which each operation is performed by a parallel process as soon as another set of inputs becomes available to it.[35]
  −
数据式编程(英语:Dataflow programming)语言描述针对数据流(英语:data stream)的操作,以及操作的输出和其他操作的输入之间的关系。这类型的语言使得描绘高重复率数据处理任务的变得更加简单,因为同样的数据操作可以应用于许多数据项。数据操作可以用有向无环图来表示。这些数据操作可以被并发执行,从而高效利用多核心处理器。[36]
  −
In compilers, straight line code (that is, sequences of statements without loops or conditional branches) may be represented by a DAG describing the inputs and outputs of each of the arithmetic operations performed within the code. This representation allows the compiler to perform common subexpression elimination efficiently.[36] At a higher level of code organization, the acyclic dependencies principle states that the dependencies between modules or components of a large software system should form a directed acyclic graph.[37]
  −
在編譯器中,直线码(不含条件分支和循环的代码段)可以使用有向无环图表示。图标示出每个算术运算的输入和输出。这种表示法让编译器能执行通用子表达式删除(英语:common subexpression elimination),使得代码更高效。[37]
     −
Causal structures
  −
Main article: Bayesian network
  −
Graphs in which vertices represent events occurring at a definite time, and where the edges are always point from the early time vertex to a late time vertex of the edge, are necessarily directed and acyclic. The lack of a cycle follows because the time associated with a vertex always increases as you follow any path in the graph so you can never return to a vertex on a path. This reflects our natural intuition that causality means events can only affect the future, they never affect the past, and thus we have no causal loops. An example of this type of directed acyclic graph are those encountered in the causal set approach to quantum gravity though in this case the graphs considered are transitively complete. In the version history example, each version of the software is associated with a unique time, typically the time the version was saved, committed or released. For citation graphs, the documents are published at one time and can only refer to older documents.
     −
Sometimes events are not associated with a specific physical time. Provided that pairs of events have a purely causal relationship, that is edges represent causal relations between the events, we will have a directed acyclic graph.[38] For instance, a Bayesian network represents a system of probabilistic events as vertices in a directed acyclic graph, in which the likelihood of an event may be calculated from the likelihoods of its predecessors in the DAG.[39] In this context, the moral graph of a DAG is the undirected graph created by adding an (undirected) edge between all parents of the same vertex (sometimes called marrying), and then replacing all directed edges by undirected edges.[40] Another type of graph with a similar causal structure is an influence diagram, the vertices of which represent either decisions to be made or unknown information, and the edges of which represent causal influences from one vertex to another.[41] In epidemiology, for instance, these diagrams are often used to estimate the expected value of different choices for intervention.[42][43]
+
For instance, in electronic circuit design, static [[combinational logic]] blocks can be represented as an acyclic system of [[logic gate]]s that computes a function of an input, where the input and output of the function are represented as individual [[bit]]s. In general, the output of these blocks cannot be used as the input unless it is captured by a register or state element which maintains its acyclic properties.<ref>{{citation|title=Timing|first=Sachin|last=Sapatnekar|publisher=Springer|year=2004|isbn=978-1-4020-7671-8|page=133|url=https://books.google.com/books?id=fL9k-VkZVr0C&pg=PA133}}.</ref>  Electronic circuit schematics either on paper or in a database are a form of directed acyclic graphs using instances or components to form a directed reference to a lower level component.  Electronic circuits themselves are not necessarily acyclic or directed.
−
举例来说,貝氏網路表示多个概率事件的关联网络。顶点表示事件,后续事件的发生可能性则可以通过其在有向无环图的前驱节点的发生概率计算出来。[39]在此基础上,一个有向无环图的端正图(英语:moral graph)通过以下方法而得到:将单个顶点的所有父节点之间添加一条无向边,再将所有的有向边换成无向边。[40]
+
 
−
另外一种具有相似因果结构的图是影响图(英语:influence diagram)。其顶点表示决策或不确定的事件,边表示两个顶点之间的因果关系。[41]在流行病学中,这些表示因果关系的图表常常用来评估不同干预手段的效果。[42][43]
+
Directed acyclic graphs may also be used as a compact representation of a collection of sequences. In this type of application, one finds a DAG in which the paths form the given sequences. When many of the sequences share the same subsequences, these shared subsequences can be represented by a shared part of the DAG, allowing the representation to use less space than it would take to list out all of the sequences separately. For example, the directed acyclic word graph is a data structure in computer science formed by a directed acyclic graph with a single source and with edges labeled by letters or symbols; the paths from the source to the sinks in this graph represent a set of strings, such as English words. Any set of sequences can be represented as paths in a tree, by forming a tree vertex for every prefix of a sequence and making the parent of one of these vertices represent the sequence with one fewer element; the tree formed in this way for a set of strings is called a trie. A directed acyclic word graph saves space over a trie by allowing paths to diverge and rejoin, so that a set of words with the same possible suffixes can be represented by a single tree vertex.
 +
 
 +
有向无环图也可用作序列集合的紧凑表示。在这种类型的应用程序中,人们会找到一个 DAG,其中的路径形成给定的序列。当许多序列共享相同的子序列时,这些共享子序列可以由 DAG 的一个共享部分来表示,这使得这种表示比单独列出所有序列所需要的空间更少。例如,有向无环词图是计算机科学中的一种数据结构,由一个单源的有向无环图构成,其边缘用字母或符号标记; 在这个图中,从源到汇的路径表示一组字符串,例如英语单词。任何一组序列都可以表示为树中的路径,方法是为序列的每个前缀形成一个树顶点,并使其中一个顶点的父顶点表示只有一个元素的序列; 对于一组字符串以这种方式形成的树称为 trie。有向无环词图允许路径发散和重新连接,从而在一个三元图上节省空间,这样一组可能具有相同后缀的词可以由一个树顶点表示。
 +
 
 +
 
 +
 
 +
[[Dataflow programming]] languages describe systems of operations on [[data stream]]s, and the connections between the outputs of some operations and the inputs of others. These languages can be convenient for describing repetitive data processing tasks, in which the same acyclically-connected collection of operations is applied to many data items. They can be executed as a [[parallel algorithm]] in which each operation is performed by a parallel process as soon as another set of inputs becomes available to it.<ref>{{citation|title=Programming Symposium|series=Lecture Notes in Computer Science|volume=19|year=1974|pages=362–376|contribution=First version of a data flow procedure language|first=Jack B.|last=Dennis|doi=10.1007/3-540-06859-7_145|isbn=978-3-540-06859-4}}.</ref>
 +
 
 +
The same idea of using a DAG to represent a family of paths occurs in the binary decision diagram, a DAG-based data structure for representing binary functions. In a binary decision diagram, each non-sink vertex is labeled by the name of a binary variable, and each sink and each edge is labeled by a 0 or 1. The function value for any truth assignment to the variables is the value at the sink found by following a path, starting from the single source vertex, that at each non-sink vertex follows the outgoing edge labeled with the value of that vertex's variable. Just as directed acyclic word graphs can be viewed as a compressed form of , binary decision diagrams can be viewed as compressed forms of decision trees that save space by allowing paths to rejoin when they agree on the results of all remaining decisions.
 +
 
 +
使用 DAG 表示一系列路径的同样想法也出现在二元决策图中,这是一个基于 dags 的数据结构,用于表示二进制函数。在二元决策图中,每个无汇点都用一个二进制变量的名称标记,每个汇点和每条边都用一个0或1标记。任何对变量进行真值赋值的函数值,都是指从单个源顶点开始,沿着一条路径,在每个非汇顶点上沿着标有该顶点变量值的外向边缘,在汇处找到的值。正如有向无环字图可以看作是一种压缩形式,二叉决策图可以看作是一种压缩形式的决策树,通过允许路径在所有剩余决策的结果一致时重新连接来节省空间。
 +
 
 +
 
 +
 
 +
In [[compiler]]s, straight line code (that is, sequences of statements without loops or conditional branches) may be represented by a DAG describing the inputs and outputs of each of the arithmetic operations performed within the code. This representation allows the compiler to perform [[common subexpression elimination]] efficiently.<ref>{{citation|title=Advanced Backend Optimization|first1=Sid|last1=Touati|first2=Benoit|last2=de Dinechin|publisher=John Wiley & Sons|year=2014|isbn=978-1-118-64894-0|page=123|url=https://books.google.com/books?id=nO2-AwAAQBAJ&pg=PA123}}.</ref> At a higher level of code organization, the [[acyclic dependencies principle]] states that the dependencies between modules or components of a large software system should form a directed acyclic graph.<ref>{{citation|title=Large-Scale Software Architecture: A Practical Guide using UML|first1=Jeff|last1=Garland|first2=Richard|last2=Anthony|publisher=John Wiley & Sons|year=2003|isbn=9780470856383|page=215|url=https://books.google.com/books?id=_2oQLLSqZ88C&pg=PA215}}.</ref>
 +
 
 +
 
 +
 
 +
[[Feedforward neural network]]s are another example.
 +
 
 +
 
 +
 
 +
=== Causal structures ===
 +
 
 +
{{main|Bayesian network}}
 +
 
 +
Graphs in which vertices represent events occurring at a definite time, and where the edges are always point from the early time vertex to a late time vertex of the edge, are necessarily directed and acyclic. The lack of a cycle follows because the time associated with a vertex always increases as you follow any [[Path (graph theory)|path]] in the graph so you can never return to a vertex on a path.  This reflects our natural intuition that causality means events can only affect the future, they never affect the past, and thus we have no [[causal loop]]s. An example of this type of directed acyclic graph are those encountered in the [[Causal sets|causal set approach to quantum gravity]] though in this case the graphs considered are [[#Transitive closure and transitive reduction|transitively complete]]. In the version history example, each version of the software is associated with a unique time, typically the time the version was saved, committed or released. For citation graphs, the documents are published at one time and can only refer to older documents.
 +
 
 +
 
 +
 
 +
Sometimes events are not associated with a specific physical time. Provided that pairs of events have a purely causal relationship, that is edges represent [[causality|causal relations]] between the events, we will have a directed acyclic graph.<ref>{{citation|title=Causal Learning|first1=Alison|last1=Gopnik|first2=Laura|last2=Schulz|publisher=Oxford University Press|year=2007|isbn=978-0-19-803928-0|page=4|url=https://books.google.com/books?id=35MKXlKoXIUC&pg=PA4}}.</ref> For instance, a [[Bayesian network]] represents a system of probabilistic events as vertices in a directed acyclic graph, in which the likelihood of an event may be calculated from the likelihoods of its predecessors in the DAG.<ref>{{citation|title=Probabilistic Boolean Networks: The Modeling and Control of Gene Regulatory Networks|publisher=Society for Industrial and Applied Mathematics|first1=Ilya|last1=Shmulevich|first2=Edward R.|last2=Dougherty|year=2010|isbn=978-0-89871-692-4|page=58|url=https://books.google.com/books?id=RfshqEgO7KgC&pg=PA58}}.</ref> In this context, the [[moral graph]] of a DAG is the undirected graph created by adding an (undirected) edge between all parents of the same vertex (sometimes called ''marrying''), and then replacing all directed edges by undirected edges.<ref>{{citation |last1= Cowell |first1= Robert G. |author2-link=Philip Dawid|last2=Dawid|first2=A. Philip|author3-link=Steffen Lauritzen|last3=Lauritzen|first3=Steffen L.|author4-link=David Spiegelhalter|last4=Spiegelhalter|first4=David J.|title= Probabilistic Networks and Expert Systems |publisher= Springer |year= 1999 |isbn= 978-0-387-98767-5 |chapter= 3.2.1 Moralization|pages= 31–33 }}.</ref> Another type of graph with a similar causal structure is an [[influence diagram]], the vertices of which represent either decisions to be made or unknown information, and the edges of which represent causal influences from one vertex to another.<ref>{{citation|title=The Technology Management Handbook|first=Richard C.|last=Dorf|publisher=CRC Press|year=1998|isbn=978-0-8493-8577-3|page=9{{hyphen}}7<!-- Do not conver this hyphen into a dash! It is a section-page number, not a range of page numbers. -->|url=https://books.google.com/books?id=C2u8I0DFo4IC&pg=SA9-PA7}}.</ref> In [[epidemiology]], for instance, these diagrams are often used to estimate the expected value of different choices for intervention.<ref>{{citation|title=Encyclopedia of Epidemiology, Volume 1|first=Sarah|last=Boslaugh|publisher=SAGE|year=2008|isbn=978-1-4129-2816-8|page=255|url=https://books.google.com/books?id=wObgnN3x14kC&pg=PA255}}.</ref><ref name="pearl:95">{{citation | last = Pearl | first = Judea | doi = 10.1093/biomet/82.4.669 | issue = 4 | journal = Biometrika | pages = 669–709 | title = Causal diagrams for empirical research | volume = 82 | year = 1995| url = https://escholarship.org/uc/item/6gv9n38c }}.</ref>
 +
 
 +
Category:Directed graphs
 +
 
 +
类别: 有向图
 +
 
 +
 
 +
 
 +
Category:Directed acyclic graphs
 +
 
 +
范畴: 有向无圈图
 +
 
 +
The converse is also true.  That is in any application represented by a directed acyclic graph there is a causal structure, either an explicit order or time in the example or an order which can be derived from graph structure. This follows because all directed acyclic graphs have a [[#Topological ordering|topological ordering]], i.e. there is at least one way to put the vertices in an order such that all edges point in the same direction along that order.
 +
 
 +
 
 +
 
 +
de:Graph (Graphentheorie)#Teilgraphen.2C Wege und Zyklen
    +
de:Graph (Graphentheorie)#Teilgraphen.2C Wege und Zyklen
   −
The converse is also true. That is in any application represented by a directed acyclic graph there is a causal structure, either an explicit order or time in the example or an order which can be derived from graph structure. This follows because all directed acyclic graphs have a topological ordering, i.e. there is at least one way to put the vertices in an order such that all edges point in the same direction along that order.
+
<noinclude>
−
Genealogy and version history
     −
Family trees may be seen as directed acyclic graphs, with a vertex for each family member and an edge for each parent-child relationship.[44] Despite the name, these graphs are not necessarily trees because of the possibility of marriages between relatives (so a child has a common ancestor on both the mother's and father's side) causing pedigree collapse.[45] The graphs of matrilineal descent ("mother" relationships between women) and patrilineal descent ("father" relationships between men) are trees within this graph. Because no one can become their own ancestor, family trees are acyclic.[46]
+
<small>This page was moved from [[wikipedia:en:Directed acyclic graph]]. Its edit history can be viewed at [[有向无环图/edithistory]]</small></noinclude>
−
系谱学和版本历史
  −
谱系图可以看作是有向无环图,顶点代表家族成员,边代表亲子关系。[44]虽然谱系图也被称作为家族“树”, 但近亲结婚导致的血统崩溃(英语:pedigree collapse)会违反树的性质。即一个孩子的祖先既可以从父亲向上追溯,也可以从母亲一侧。[45]图中的母系血统和父系血统则可以看作为树。因为没有人可以是自己的祖先,谱系图是无环的。[46]
  −
The version history of a distributed revision control system, such as Git, generally has the structure of a directed acyclic graph, in which there is a vertex for each revision and an edge connecting pairs of revisions that were directly derived from each other. These are not trees in general due to merges.[47]
  −
基于相同的原因, 一个分散式版本控制系统的版本历史的结构也是有向无环图。在系统中,每个版本对应一个节点。边连接起有直接衍生关系的两个版本。由于分支合并的存在,这个结构并不能用树来表示。[47]
  −
In many randomized algorithms in computational geometry, the algorithm maintains a history DAG representing the version history of a geometric structure over the course of a sequence of changes to the structure. For instance in a randomized incremental algorithm for Delaunay triangulation, the triangulation changes by replacing one triangle by three smaller triangles when each point is added, and by "flip" operations that replace pairs of triangles by a different pair of triangles. The history DAG for this algorithm has a vertex for each triangle constructed as part of the algorithm, and edges from each triangle to the two or three other triangles that replace it. This structure allows point location queries to be answered efficiently: to find the location of a query point q in the Delaunay triangulation, follow a path in the history DAG, at each step moving to the replacement triangle that contains q. The final triangle reached in this path must be the Delaunay triangle that contains q.[48]
  −
在计算几何领域,许多随机化算法都会维护一个“历史有向无环图”,用以记录结构变动中的旧几何结构。例如,在德勞內三角化的随机增量算法中,在添加每个点时,通过用三个较小的三角形替换一个三角形,以及通过“翻转”操作将三角形对替换为另一对三角形,来改变三角剖分。在该算法的历史有向无环图中,每个在算法中构建出的三角形对应一个顶点,边则将每个三角形和替代它的两个或三个三角形连接起来。这种图结构可以高效地处理点定位(英语:point location)问题,即对于一个查询点q,找到它在德勞內三角剖分中的位置。在历史有向无环图中,从起点开始,不断移动到包含q的替代三角形组,最后到达的终点必定代表包含q的德劳内三角形。[48]
  −
Citation graphs
  −
In a citation graph the vertices are documents with a single publication date. The edges represent the citations from the bibliography of one document to other necessarily earlier documents. The classic example comes from the citations between academic papers as pointed out in the 1965 article "Networks of Scientific Papers"[49] by Derek J. de Solla Price who went on to produce the first model of a citation network, the Price model.[50] In this case the citation count of a paper is just the in-degree of the corresponding vertex of the citation network. This is an important measure in citation analysis. Court judgements provide another example as judges support their conclusions in one case by recalling other earlier decisions made in previous cases. A final example is provided by patents which must refer to earlier prior art, earlier patents which are relevant to the current patent claim. By taking the special properties of directed acyclic graphs into account, one can analyse citation networks with techniques not available when analysing the general graphs considered in many studies using network analysis. For instance transitive reduction gives a new insights into the citation distributions found in different applications highlighting clear differences in the mechanisms creating citations networks in different contexts.[51] Another technique is main path analysis, which traces the citation links and suggests the most significant citation chains in a given citation graph.
  −
引用图
  −
在引用图(英语:citation graph)中, 每个顶点代表单篇著作,边代表著作之间的引用关系。1965年普莱斯的文章“科学文献的网络”是使用引用图的一个经典例子。[49]在引用图中,每篇论文的引用次数(英语:Citation impact)为对应顶点的入度。这是引文分析中的一种重要的展示方式。另一个例子是法律裁判中,法官通过引用过往案例中的判决来支持他们的结论。引用图亦可以用来描绘专利,因为专利必须要提及现有技术,即已经公开的并且和本专利有关的先前专利。
     −
The Price model is too simple to be a realistic model of a citation network but it is simple enough to allow for analytic solutions for some of its properties. Many of these can be found by using results derived from the undirected version of the Price model, the Barabási–Albert model. However, since Price's model gives a directed acyclic graph, it is a useful model when looking for analytic calculations of properties unique to directed acyclic graphs. For instance, the length of the longest path, from the n-th node added to the network to the first node in the network, scales as[52]
+
[[Category:待整理页面]]
−
.相较于网络科学中对一般图的研究,有向无环图的独特性质可以被用来作深层次分析。例如,传递规约可以呈现引用在不同应用领域的分布情况,这突出了不同领域中不同的引用网构造机制。[50]引用图的衍生概念还有主干道路分析(英语:Main path analysis),即对引用图中最显著的一条路径的分析。
  −
Data compression
  −
Directed acyclic graphs may also be used as a compact representation of a collection of sequences. In this type of application, one finds a DAG in which the paths form the given sequences. When many of the sequences share the same subsequences, these shared subsequences can be represented by a shared part of the DAG, allowing the representation to use less space than it would take to list out all of the sequences separately. For example, the directed acyclic word graph is a data structure in computer science formed by a directed acyclic graph with a single source and with edges labeled by letters or symbols; the paths from the source to the sinks in this graph represent a set of strings, such as English words.[53] Any set of sequences can be represented as paths in a tree, by forming a tree vertex for every prefix of a sequence and making the parent of one of these vertices represent the sequence with one fewer element; the tree formed in this way for a set of strings is called a trie. A directed acyclic word graph saves space over a trie by allowing paths to diverge and rejoin, so that a set of words with the same possible suffixes can be represented by a single tree vertex.[54]
  −
数据压缩
  −
有向无环图也可以用于对一系列序列的压缩中。在这里,有向无环图中的路径代表这些序列。当多个序列有共同的子序列时,子序列可以被表示为这些序列对应路径的公共边。比起直接列出所有序列,这种方法占用更少空间。例如,有向无环词图(英语:Deterministic acyclic finite state automaton)为仅含单个源(入度为0的顶点)的有向无环图,其每条边附有一个或多个字符。每条其源到汇(出度为0的节点)的路径均代表一个字符串,字符串可以是英文单词。[51]与其结构不同但功能相似的树称为trie。相比于trie,有向无环词图允许多条边指向同一个顶点,使得具有相同后缀的一些词的词头可以被相同的顶点所表示,因而更省空间。[52]
  −
The same idea of using a DAG to represent a family of paths occurs in the binary decision diagram,[55][56] a DAG-based data structure for representing binary functions. In a binary decision diagram, each non-sink vertex is labeled by the name of a binary variable, and each sink and each edge is labeled by a 0 or 1. The function value for any truth assignment to the variables is the value at the sink found by following a path, starting from the single source vertex, that at each non-sink vertex follows the outgoing edge labeled with the value of that vertex's variable. Just as directed acyclic word graphs can be viewed as a compressed form of tries, binary decision diagrams can be viewed as compressed forms of decision trees that save space by allowing paths to rejoin when they agree on the results of all remaining decisions.[57]
  −
二元决策图是基于有向无环图的一种数据结构,用于表示布尔函数[53][54]。在二元决策图中,每个非汇节点对应一个布尔变量,每个汇和边则表示0或1。要找到一个解释的真值,只要从唯一的源顶点出发,沿着该顶点代表的布尔变量的实际真值所对应的出边一直前进,到达的汇则为其真值。如同有向无环词图可以被看作是trie的一种压缩形式一样,二元决策图可以被看作是决策树的压缩形式。它通过将导向相同结果的边重新汇合到一个顶点来节省空间。[55]
 
387

个编辑

导航菜单