From Wikipedia, the free encyclopedia Contents

1 Connectivity () 1 1.1 Connected graph ...... 2 1.2 Definitions of components, cuts and connectivity ...... 2 1.3 Menger’s theorem ...... 3 1.4 Computational aspects ...... 4 1.5 Examples ...... 4 1.6 Bounds on connectivity ...... 4 1.7 Other properties ...... 4 1.8 See also ...... 5 1.9 References ...... 5

2 (graph theory) 6 2.1 Chordless cycles ...... 7 2.2 ...... 7 2.3 ...... 7 2.4 Covering graphs by cycles ...... 7 2.5 Graph classes defined by cycles ...... 8 2.6 References ...... 8

3 9 3.1 Mathematical properties ...... 10 3.1.1 , , and ...... 10 3.1.2 Topological ordering ...... 11 3.1.3 Combinatorial enumeration ...... 11 3.1.4 Related families of graphs ...... 11 3.2 Computational problems ...... 11 3.2.1 and recognition ...... 11 3.2.2 Construction from cyclic graphs ...... 12 3.2.3 Transitive closure and transitive reduction ...... 12 3.2.4 Closure problem ...... 12 3.3 Applications ...... 12 3.3.1 ...... 12 3.3.2 Scheduling ...... 12

i ii CONTENTS

3.3.3 Data processing networks ...... 13 3.3.4 Causal structures ...... 13 3.3.5 Genealogy and version history ...... 13 3.3.6 ...... 14 3.4 References ...... 14 3.5 External links ...... 16

4 17 4.1 Basic terminology ...... 18 4.2 Indegree and outdegree ...... 18 4.3 Degree ...... 19 4.4 Digraph connectivity ...... 19 4.5 Classes of digraphs ...... 20 4.6 See also ...... 21 4.7 Notes ...... 22 4.8 References ...... 22

5 Orientation (graph theory) 23 5.1 Oriented graphs ...... 23 5.2 Constrained orientations ...... 23 5.3 References ...... 24 5.4 External links ...... 24

6 Polytree 25 6.1 Related structures ...... 26 6.2 Enumeration ...... 26 6.3 Sumner’s conjecture ...... 26 6.4 Applications ...... 26 6.5 See also ...... 26 6.6 Notes ...... 26 6.7 References ...... 27

7 Tournament (graph theory) 28 7.1 Paths and cycles ...... 28 7.2 Transitivity ...... 28 7.2.1 Equivalent conditions ...... 28 7.2.2 Ramsey theory ...... 29 7.2.3 Paradoxical tournaments ...... 30 7.2.4 Condensation ...... 30 7.3 Score and score sets ...... 30 7.4 See also ...... 31 7.5 Notes ...... 31 7.6 References ...... 31 CONTENTS iii

8 (graph theory) 33 8.1 Definitions ...... 33 8.1.1 Plane tree ...... 34 8.2 Example ...... 34 8.3 Facts ...... 34 8.4 Enumeration ...... 35 8.4.1 Labeled trees ...... 35 8.4.2 Unlabeled trees ...... 35 8.5 Types of trees ...... 36 8.6 See also ...... 36 8.7 Notes ...... 36 8.8 References ...... 37 8.9 Further reading ...... 37 8.10 Text and image sources, contributors, and licenses ...... 38 8.10.1 Text ...... 38 8.10.2 Images ...... 38 8.10.3 Content license ...... 39 Chapter 1

Connectivity (graph theory)

This graph becomes disconnected when the right-most node in the gray on the left is removed

In and , connectivity is one of the basic concepts of graph theory: it asks for the

1 2 CHAPTER 1. CONNECTIVITY (GRAPH THEORY)

This graph becomes disconnected when the dashed edge is removed.

minimum number of elements (nodes or edges) that need to be removed to disconnect the remaining nodes from each other.[1] It is closely related to the theory of network flow problems. The connectivity of a graph is an important measure of its robustness as a network.

1.1 Connected graph

A graph is connected when there is a path between every pair of vertices. In a connected graph, there are no unreachable vertices. A graph that is not connected is disconnected. A graph with just one is connected. An edgeless graph with two or more vertices is disconnected.

1.2 Definitions of components, cuts and connectivity

In an undirected graph G, two vertices u and v are called connected if G contains a path from u to v. Otherwise, they are called disconnected. If the two vertices are additionally connected by a path of length 1, i.e. by a single edge, the vertices are called adjacent.A graph is said to be connected if every pair of vertices in the graph is connected. A connected is a maximal connected subgraph of G. Each vertex belongs to exactly one connected com- ponent, as does each edge. A directed graph is called weakly connected if replacing all of its directed edges with undirected edges produces a connected (undirected) graph. It is connected if it contains a directed path from u to v or a directed path from v to u for every pair of vertices u, v. It is strongly connected or strong if it contains a directed path from u to v and a directed path from v to u for every pair of vertices u, v. The strong components are the maximal strongly connected subgraphs. A cut, vertex cut, or separating of a connected graph G is a set of vertices whose removal renders G disconnected. The connectivity or vertex connectivity κ(G) (where G is not a ) is the size of a minimal vertex cut. A graph is called k-connected or k-vertex-connected if its vertex connectivity is k or greater. More precisely, any graph G (complete or not) is said to be k-connected if it contains at least k+1 vertices, but does 1.3. MENGER’S THEOREM 3

With vertex 0 this graph is disconnected, the rest of the graph is connected.

not contain a set of k − 1 vertices whose removal disconnects the graph; and κ(G) is defined as the largest k such that G is k-connected. In particular, a complete graph with n vertices, denoted K, has no vertex cuts at all, but κ(Kn) = n − 1. A vertex cut for two vertices u and v is a set of vertices whose removal from the graph disconnects u and v. The local connectivity κ(u, v) is the size of a smallest vertex cut separating u and v. Local connectivity is symmetric for undirected graphs; that is, κ(u, v) = κ(v, u). Moreover, except for complete graphs, κ(G) equals the minimum of κ(u, v) over all nonadjacent pairs of vertices u, v. 2-connectivity is also called biconnectivity and 3-connectivity is also called triconnectivity. A graph G which is con- nected but not 2-connected is sometimes called separable. Analogous concepts can be defined for edges. In the simple case in which cutting a single, specific edge would disconnect the graph, that edge is called a . More generally, the edge cut of G is a group of edges whose total removal renders the graph disconnected. The edge-connectivity λ(G) is the size of a smallest edge cut, and the local edge-connectivity λ(u, v) of two vertices u, v is the size of a smallest edge cut disconnecting u from v. Again, local edge-connectivity is symmetric. A graph is called k-edge-connected if its edge connectivity is k or greater.

1.3 Menger’s theorem

Main article: Menger’s theorem

One of the most important facts about connectivity in graphs is Menger’s theorem, which characterizes the connec- tivity and edge-connectivity of a graph in terms of the number of independent paths between vertices. If u and v are vertices of a graph G, then a collection of paths between u and v is called independent if no two of them share a vertex (other than u and v themselves). Similarly, the collection is edge-independent if no two paths in it share an edge. The number of mutually independent paths between u and v is written as κ′(u, v), and the number of mutually edge-independent paths between u and v is written as λ′(u, v). Menger’s theorem asserts that the local connectivity κ(u, v) equals κ′(u, v) and the local edge-connectivity λ(u, v) equals λ′(u, v) for every pair of vertices u and v.[2][3] This fact is actually a special case of the max-flow min-cut theorem. 4 CHAPTER 1. CONNECTIVITY (GRAPH THEORY)

1.4 Computational aspects

The problem of determining whether two vertices in a graph are connected can be solved efficiently using a search , such as breadth-first search. More generally, it is easy to determine computationally whether a graph is connected (for example, by using a disjoint-set ), or to count the number of connected components. A simple algorithm might be written in pseudo-code as follows:

1. Begin at any arbitrary node of the graph, G

2. Proceed from that node using either depth-first or breadth-first search, counting all nodes reached.

3. Once the graph has been entirely traversed, if the number of nodes counted is equal to the number of nodes of G, the graph is connected; otherwise it is disconnected.

By Menger’s theorem, for any two vertices u and v in a connected graph G, the numbers κ(u, v) and λ(u, v) can be determined efficiently using the max-flow min-cut algorithm. The connectivity and edge-connectivity of G can then be computed as the minimum values of κ(u, v) and λ(u, v), respectively. In computational complexity theory, SL is the class of problems log-space reducible to the problem of determining whether two vertices in a graph are connected, which was proved to be equal to L by Omer Reingold in 2004.[4] Hence, undirected graph connectivity may be solved in O(log n) space. The problem of computing the probability that a Bernoulli is connected is called network reliability and the problem of computing whether two given vertices are connected the ST-reliability problem. Both of these are #P-hard.[5]

1.5 Examples

• The vertex- and edge-connectivities of a disconnected graph are both 0.

• 1-connectedness is equivalent to connectedness.

• The complete graph on n vertices has edge-connectivity equal to n − 1. Every other simple graph on n vertices has strictly smaller edge-connectivity.

• In a tree, the local edge-connectivity between every pair of vertices is 1.

1.6 Bounds on connectivity

• The vertex-connectivity of a graph is less than or equal to its edge-connectivity. That is, κ(G) ≤ λ(G). Both are less than or equal to the minimum degree of the graph, since deleting all neighbors of a vertex of minimum degree will disconnect that vertex from the rest of the graph.[1]

• For a vertex-transitive graph of degree d, we have: 2(d + 1)/3 ≤ κ(G) ≤ λ(G) = d.[6]

• For a vertex-transitive graph of degree d ≤ 4, or for any (undirected) minimal of degree d, or for any symmetric graph of degree d, both kinds of connectivity are equal: κ(G) = λ(G) = d.[7]

1.7 Other properties

• Connectedness is preserved by graph homomorphisms.

• If G is connected then its L(G) is also connected.

• A graph G is 2-edge-connected if and only if it has an orientation that is strongly connected. 1.8. SEE ALSO 5

• Balinski’s theorem states that the polytopal graph (1-skeleton) of a k-dimensional convex polytope is a k-vertex- connected graph.[8] Steinitz's previous theorem that any 3-vertex-connected is a polytopal graph (Steinitz theorem) gives a partial converse.

• According to a theorem of G. A. Dirac, if a graph is k-connected for k ≥ 2, then for every set of k vertices in the graph there is a cycle that passes through all the vertices in the set.[9][10] The converse is true when k = 2.

1.8 See also

• Algebraic connectivity

• Cheeger constant (graph theory) • Expander graph

• Graph property • Scale-free network

• Small-world networks, Six degrees of separation, Small world phenomenon • Strength of a graph (graph theory)

1.9 References

[1] Diestel, R., Graph Theory, Electronic Edition, 2005, p 12.

[2] Gibbons, A. (1985). Algorithmic Graph Theory. Cambridge University Press.

[3] Nagamochi, H., Ibaraki, T. (2008). Algorithmic Aspects of Graph Connectivity. Cambridge University Press.

[4] Reingold, Omer (2008). “Undirected connectivity in log-space”. Journal of the ACM 55 (4): Article 17, 24 pages. doi:10.1145/1391289.1391291

[5] Provan, J. Scott; Ball, Michael O. (1983), “The complexity of counting cuts and of computing the probability that a graph is connected”, SIAM Journal on Computing 12 (4): 777–788, doi:10.1137/0212053, MR 721012.

[6] Godsil, C.; Royle, G. (2001). Algebraic Graph Theory. Springer Verlag.

[7] Babai, L. (1996). Automorphism groups, isomorphism, reconstruction. Technical Report TR-94-10. University of Chicago. Chapter 27 of The Handbook of Combinatorics.

[8] Balinski, M. L. (1961). “On the graph structure of convex polyhedra in n-space”. Pacific Journal of Mathematics 11 (2): 431–434. doi:10.2140/pjm.1961.11.431.

[9] Dirac, Gabriel Andrew (1960). “In abstrakten Graphen vorhandene vollständige 4-Graphen und ihre Unterteilungen”. Mathematische Nachrichten 22: 61–85. doi:10.1002/mana.19600220107. MR 0121311.

[10] Flandrin, Evelyne; Li, Hao; Marczyk, Antoni; Woźniak, Mariusz (2007). “A generalization of Dirac’s theorem on cycles through k vertices in k-connected graphs”. 307 (7–8): 878–884. doi:10.1016/j.disc.2005.11.052. MR 2297171. Chapter 2

Cycle (graph theory)

A graph with edges colored to illustrate path H-A-B, closed path or walk with a repeated vertex B-D-E-F-D-C-B and a cycle with no repeated edge or vertex H-D-G-H

In graph theory, there are several different types of object called cycles; a closed walk and a simple cycle. A closed walk consists of a sequence of vertices starting and ending at the same vertex, with each two consecutive vertices in the sequence adjacent to each other in the graph. In a directed graph, each edge must be traversed by the walk consistently with its direction: the edge must be oriented from the earlier of two consecutive vertices to the later of the two vertices in the sequence. The choice of starting vertex is not important: traversing the same cyclic sequence of edges from different starting vertices produces the same closed walk. A simple cycle may be defined either as a closed walk with no repetitions of vertices and edges allowed, other than the repetition of the starting and ending vertex, or as the set of edges in such a walk. The two definitions are equivalent in directed graphs, where simple cycles are also called directed cycles: the cyclic sequence of vertices and edges

6 2.1. CHORDLESS CYCLES 7

in a walk is completely determined by the set of edges that it uses. In undirected graphs the set of edges of a cycle can be traversed by a walk in either of two directions, giving two possible directed cycles for every undirected cycle. (For closed walks more generally, in directed or undirected graphs, the multiset of edges does not unambiguously determine the vertex ordering.) A circuit can be a closed walk allowing repetitions of vertices but not edges; however, the term is also sometimes used to describe a simple cycle, so explicit definition is recommended when it is used.[1]

2.1 Chordless cycles

A chordless cycle in a graph, also called a hole or an induced cycle, is a cycle such that no two vertices of the cycle are connected by an edge that does not itself belong to the cycle. An antihole is the complement of a graph hole. Chordless cycles may be used to characterize perfect graphs: by the strong theorem, a graph is perfect if and only if none of its holes or antiholes have an odd number of vertices that is greater than three. A , a special type of perfect graph, has no holes of any size greater than three. The of a graph is the length of its shortest cycle; this cycle is necessarily chordless. Cages are defined as the smallest regular graphs with given combinations of degree and girth. A is a cycle in a graph with the property that every two edges not on the cycle can be connected by a path whose interior vertices avoid the cycle. In a graph that is not formed by adding one edge to a cycle, a peripheral cycle must be an induced cycle.

2.2 Cycle space

The term cycle may also refer to an element of the cycle space of a graph. This consists of the edge sets that have an even degree at every vertex; it forms a vector space over the two-element finite field. Using methods from algebraic topology, it may be generalized to vector spaces or modules over other rings such as the integers, real numbers, etc. By Veblen’s theorem, every element of the cycle space may be formed by combining simple cycles; a of the graph is a set of simple cycles that forms a basis of the cycle space.[2][3]

2.3 Cycle detection

The existence of a cycle in directed and undirected graphs can be determined by whether depth-first search (DFS) finds an edge that points to an ancestor of the current vertex (it contains a back edge).[4] In an undirected graph, finding any already visited vertex will indicate a back edge. All the back edges which DFS skips over are part of cycles.[5] In the case of undirected graphs, only O(n) time is required to find a cycle in an n-vertex graph, since at most n − 1 edges can be tree edges. Many topological sorting algorithms will detect cycles too, since those are obstacles for topological order to exist. Also, if a directed graph has been divided into strongly connected components, cycles only exist within the compo- nents and not between them, since cycles are strongly connected.[5] For directed graphs, Rocha-Thatte Algorithm[6] is a distributed cycle detection algorithm. Distributed cycle detection algorithms are useful for processing large-scale graphs using a distributed graph processing system on a computer cluster (or supercomputer). Applications of cycle detection include the use of wait-for graphs to detect deadlocks in concurrent systems.[7]

2.4 Covering graphs by cycles

In his 1736 paper on the Seven Bridges of Königsberg, widely considered to be the birth of graph theory, Leonhard Euler proved that, for a finite undirected graph to have a closed walk that visits each edge exactly once, it is necessary and sufficient that it be connected and have even degree at each vertex. The corresponding characterization for the existence of a closed walk visiting each edge exactly once in a directed graph is that the graph be strongly connected and have equal numbers of incoming and outgoing edges at each vertex. In either case, the resulting walk is known as an Euler cycle or Euler tour. If a finite undirected graph has even degree at each of its vertices, regardless of whether 8 CHAPTER 2. CYCLE (GRAPH THEORY) it is connected, then it is possible to find a set of simple cycles that together cover each edge exactly once: this is Veblen’s theorem. [8]When a connected graph does not meet the conditions of Euler’s theorem, a closed walk of minimum length covering each edge at least once can nevertheless be found in polynomial time by solving the . The problem of finding a single simple cycle that covers each vertex exactly once, rather than covering the edges, is much harder. Such a cycle is known as a Hamiltonian cycle, and determining whether it exists is NP-complete.[9] Much research has been published concerning classes of graphs that can be guaranteed to contain Hamiltonian cycles; one example is Ore’s theorem that a Hamiltonian cycle can always be found in a graph for which every non-adjacent pair of vertices have degrees summing to at least the total number of vertices in the graph.[10] The states that, for every bridgeless graph, there exists a multiset of simple cycles that covers each edge of the graph exactly twice. Proving that this is true (or finding a counterexample) remains an open problem.[11]

2.5 Graph classes defined by cycles

Several important classes of graphs can be defined by or characterized by their cycles. These include:

, a graph without odd cycles. • Cactus graph, a graph in which every nontrivial is a cycle • , a graph that consists of a single cycle. • Chordal graph, a graph with no induced cycles of length greater than three • Directed acyclic graph, a directed graph with no cycles • Perfect graph, a graph with no induced cycles or their complements of odd length greater than three • , a graph in which each connected component has at most one cycle • Strongly connected graph, a directed graph in which every edge is part of a cycle • Triangle-free graph, a graph without three-vertex cycles

2.6 References

[1] Balakrishnan, V.K. (2005). Schaum’s outline of theory and problems of graph theory ([Nachdr.]. ed.). McGraw-Hill. ISBN 978-0070054899. [2] Gross, Jonathan L.; Yellen, Jay (2005), “4.6 Graphs and Vector Spaces”, Graph Theory and Its Applications (2nd ed.), CRC Press, pp. 197–207, ISBN 9781584885054. [3] Diestel, Reinhard (2012), “1.9 Some ”, Graph Theory, Graduate Texts in Mathematics 173, Springer, pp. 23–28. [4] Tucker, Alan (2006). “Chapter 2: Covering Circuits and Graph Colorings”. Applied Combinatorics (5th ed.). Hoboken: John & sons. p. 49. ISBN 978-0-471-73507-6. [5] Sedgewick, Robert (1983), “Graph algorithms”, Algorithms, Addison-Wesley, ISBN 0-201-06672-6 [6] Rocha, Rodrigo Caetano; Thatte, Bhalchandra (2015), Distributed cycle detection in large-scale sparse graphs [7] Silberschatz, Abraham; Peter Galvin; Greg Gagne (2003). Operating System Concepts. John Wiley & Sons, INC. p. 260. ISBN 0-471-25060-0. [8] Veblen, Oswald (1912), “An Application of Modular Equations in Analysis Situs”, Annals of Mathematics, Second Series 14 (1): 86–94, JSTOR 1967604. [9] Richard M. Karp (1972), “Reducibility Among Combinatorial Problems” (PDF), in R. E. Miller and J. W. Thatcher, Complexity of Computer Computations, : Plenum, pp. 85–103. [10] Ore, Ø. (1960), “Note on Hamilton circuits”, American Mathematical Monthly 67 (1): 55, JSTOR 2308928. [11] Jaeger, F. (1985), “A survey of the cycle double cover conjecture”, Annals of Discrete Mathematics 27 – Cycles in Graphs, North-Holland Mathematics Studies 27, pp. 1–12, doi:10.1016/S0304-0208(08)72993-1.. Chapter 3

Directed acyclic graph

5

10

11 3 2 9

7 8

An example of a directed acyclic graph

In mathematics and computer science, a directed acyclic graph (DAG i/ˈdæɡ/), is a directed graph with no directed cycles. That is, it is formed by a collection of vertices and directed edges, each edge connecting one vertex to another, such that there is no way to start at some vertex v and follow a sequence of edges that eventually loops back to v again.[1][2][3] DAGs may be used to model many different kinds of information. The reachability in a DAG forms a partial order, and any finite partial order may be represented by a DAG using reachability. A collection of tasks that must be ordered into a sequence, subject to constraints that certain tasks must be performed earlier than others, may be represented as a DAG with a vertex for each task and an edge for each constraint; algorithms for topological ordering may be used to generate a valid sequence. Additionally, DAGs may be used as a space-efficient representation of a collection of sequences with overlapping subsequences. DAGs are also used to represent systems of events or potential events and the causal relationships between them. DAGs may also be used to model processes in which data flows in a consistent direction through a network of processors, or states of a repository in a version-control system.

9 10 CHAPTER 3. DIRECTED ACYCLIC GRAPH

The corresponding concept for undirected graphs is a forest, an undirected graph without cycles. Choosing an orien- tation for a forest produces a special kind of directed acyclic graph called a polytree. However there are many other kinds of directed acyclic graph that are not formed by orienting the edges of an undirected acyclic graph. Moreover, every undirected graph has an , an assignment of a direction for its edges that makes it into a di- rected acyclic graph. For these reasons it would be more accurate to call directed acyclic graphs acyclic directed graphs or acyclic digraphs.

3.1 Mathematical properties

3.1.1 Reachability, transitive closure, and transitive reduction

{x,y,z}

{x,y} {x,z} {y,z}

{x} {y} {z}

Ø

A representing the partial order among the subsets of a three-element set.

Each directed acyclic graph gives rise to a partial order ≤ on its vertices, where u ≤ v exactly when there exists a directed path from u to v in the DAG.[4] However, many different DAGs may give rise to this same reachability relation:[5] for example, the DAG with two edges a → b and b → c has the same reachability as the graph with three edges a → b, b → c, and a → c. If G is a DAG, its transitive reduction is the graph with the fewest edges that represents the same reachability as G, and its transitive closure is the graph with the most edges that represents the same reachability. The transitive reduction and transitive closure are both 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.[6] The transitive closure of G has an edge u → v 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: every may be translated into a DAG in this way. If a DAG G represents a partial order ≤, then the transitive reduction of G is a subgraph of G with an edge u → v for every pair in the 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 3.2. COMPUTATIONAL PROBLEMS 11 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.[7]

3.1.2 Topological ordering

Every directed acyclic graph has a topological ordering, an ordering of the vertices such that the starting endpoint of every edge occurs earlier in the ordering than the ending endpoint of the edge. 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.[8] The family of topological orderings of a DAG is the same as the family of linear extensions of the reachability relation for the DAG,[9] so any two graphs representing the same partial order have the same set of topological orders.

3.1.3 Combinatorial enumeration

The problem of counting directed acyclic graphs was studied by Robinson (1973).[10] The number of DAGs on n labeled nodes, for n = 0, 1, 2, 3, …, (allowing these numbers to appear in any order in a topological ordering of the DAG) is

1, 1, 3, 25, 543, 29281, 3781503, … (sequence A003024 in OEIS).

These numbers may be computed by the ∑ ( ) n − k−1 n k(n−k) [10] an = k=1( 1) k 2 an−k.

Eric W. Weisstein conjectured,[11] and McKay et al. (2004) proved,[12] that the same numbers count the (0,1) matrices in which all eigenvalues are positive real numbers. The proof is bijective: a matrix A is an 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.

3.1.4 Related families of graphs

A polytree is a directed graph formed by orienting the edges of a free tree.[13] Every polytree is a DAG. In particular, this is true of the arborescences formed by directing all edges outwards from the root 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 nodes; equivalently, it is a DAG in which, for every node v, the set of nodes reachable from v forms a tree.[14]

3.2 Computational problems

3.2.1 Topological sorting and recognition

Main article: Topological sorting

Topological sorting is the algorithmic problem of finding topological orderings; it can be solved in linear time.[15] Kahn’s algorithm for topological sorting builds the vertex ordering directly, by maintaining a list of vertices that have no edges connecting them to vertices that have not already been listed, and repeatedly adding one such vertex to the end of the list that is being built.[16] Alternatively, a topological ordering may be constructed by reversing a postorder numbering of a depth-first search graph traversal.[15] 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[17] or alternatively, for some topological sorting algorithms, by verifying that the algorithm successfully orders all the vertices without meeting an error condition.[16] 12 CHAPTER 3. DIRECTED ACYCLIC GRAPH

3.2.2 Construction from cyclic graphs

Any undirected graph may be made into a DAG by choosing a for its vertices and orienting every edge from the earlier endpoint in the order to the later endpoint. However, different total orders may lead to the same acyclic orientation. The number of acyclic orientations is equal to |χ(−1)|, where χ is the of the given graph.[18] Any directed graph may be made into a DAG by removing a or a . However, the smallest such set is NP-hard to find.[19] 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.[20] When the graph is already acyclic, its smallest feedback vertex sets and feedback arc sets are empty, and its condensation is the graph itself.

3.2.3 Transitive closure and transitive reduction

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.[21] Alternatively, it can be solved in time O(nω) where ω < 2.373 is the exponent for fast matrix multiplication algorithms; this is a theoretical improvement over the O(mn) bound for dense graphs.[22] 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.[23]

3.2.4 Closure problem

Main article: Closure problem

The closure problem takes as input a directed acyclic graph with weights on its vertices and seeks the minimum (or maximum) weight of a closure, a set of vertices with no outgoing edges. (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.[24]

3.3 Applications

3.3.1 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 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.[25] In contrast, for arbitrary graphs the shortest path may require slower algorithms such as Dijkstra’s algorithm or the Bellman–Ford algorithm,[26] and longest paths in arbitrary graphs are NP-hard to find.[27]

3.3.2 Scheduling

DAG representations of partial orderings have many applications in scheduling problems for systems of tasks with ordering constraints.[28] For instance, a DAG may be used to describe the dependencies between cells of a : if one cell is computed by a formula involving the value of a second cell, draw a DAG edge from the second cell to the first one. If the input values to the spreadsheet change, all of the remaining values of the spreadsheet may be recomputed with a single evaluation per cell, by topologically ordering the cells and re-evaluating each cell in this order.[29] Similar problems of task ordering arise in makefiles for program compilation,[29] instruction scheduling 3.3. APPLICATIONS 13 for low-level computer program optimization,[30] and PERT scheduling for management of large human projects.[31] Dependency graphs without circular dependencies form directed acyclic graphs.

3.3.3 Data processing networks

A directed graph may be used to represent a network of processing elements; in this formulation, data enters a processing element through its incoming edges and leaves the element through its outgoing edges. Examples of this include the following:

• In electronic circuit design, a combinational logic circuit is 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.[32]

• Dataflow programming languages describe systems of values that are related to each other by a directed acyclic graph. When one value changes, its successors are recalculated; each value is evaluated as a function of its predecessors in the DAG.[33]

• In , 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 to perform common subexpression elimination efficiently.[34]

• In most spreadsheet systems, the dependency graph that connects one cell to another if the first cell stores a formula that uses the value in the second cell must be a directed acyclic graph. Cycles of dependencies are disallowed because they cause the cells involved in the cycle to not have a well-defined value. Additionally, requiring the dependencies to be acyclic allows a topological sort to be used to schedule the recalculations of cell values when the spreadsheet is changed.[29]

3.3.4 Causal structures

Graphs that have vertices representing events, and edges representing causal relations between events, are often acyclic[35] – arranging the vertices in linear order of time, all arrows point in the same direction as time, from parent to child (due to affecting the future, not the past), and thus have no loops. For instance, a represents a system of probabilistic events as nodes in a directed acyclic graph, in which the likelihood of an event may be calculated from the likelihoods of its predecessors in the DAG.[36] In this context, the of a DAG is the undirected graph created by adding an (undirected) edge between all parents of the same node (sometimes called marrying), and then replacing all directed edges by undirected edges.[37] Another type of graph with a similar causal structure is an influence diagram, the nodes of which represent either decisions to be made or unknown information, and the edges of which represent causal influences from one node to another.[38] In epidemiology, for instance, these diagrams are often used to estimate the expected value of different choices for intervention.[39][40] The role of DAGs in these applications is to convert causal assumptions into conditional independencies constraints, which can be read from the DAG using Pearl’s d-separation[41] and tested in the data.

3.3.5 Genealogy and version history

Family trees may also be seen as directed acyclic graphs, with a vertex for each family member and an edge for each parent-child relationship.[42] Despite the name, these graphs are not necessarily trees because of the possibility of marriages between distant 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 no one can become their own ancestor, these graphs are acyclic. For the same reason, the version history of a distributed revision control system 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.[43] In many randomized algorithms in , 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 , the triangulation changes by replacing one triangle 14 CHAPTER 3. DIRECTED ACYCLIC GRAPH 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. Tracing a path through this DAG representing the sequence of triangles that contain an individual point allows point location queries to be answered efficiently.[44]

3.3.6 Data compression

Another type of application of directed acyclic graphs arises in the concise representation of a set of sequences as paths in a graph. 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.[45] Any set of sequences can be represented as paths in a tree, by forming a tree node for every prefix of a sequence and making the parent of one of these nodes represent the sequence with one fewer element; the tree formed in this way for a set of strings is called a .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 node. The same idea of using a DAG to represent a family of paths occurs in the ,[46][47] 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.

3.4 References

[1] Christofides, Nicos (1975), Graph theory: an algorithmic approach, Academic Press, pp. 170–174.

[2] Thulasiraman, K.; Swamy, M. N. S. (1992), “5.7 Acyclic Directed Graphs”, Graphs: Theory and Algorithms, John Wiley and Son, p. 118, ISBN 978-0-471-51356-8.

[3] Bang-Jensen, Jørgen (2008), “2.1 Acyclic Digraphs”, Digraphs: Theory, Algorithms and Applications, Springer Monographs in Mathematics (2nd ed.), Springer-Verlag, pp. 32–34, ISBN 978-1-84800-997-4.

[4] Kozen, Dexter (1992), The Design and Analysis of Algorithms, Monographs in Computer Science, Springer, p. 9, ISBN 978-0-387-97687-7.

[5] Banerjee, Utpal (1993), “Exercise 2(c)", Loop Transformations for Restructuring Compilers: The Foundations, Springer, p. 19, ISBN 978-0-7923-9318-4.

[6] Bang-Jensen, Jørgen; Gutin, Gregory Z. (2008), “2.3 Transitive Digraphs, Transitive Closures and Reductions”, Digraphs: Theory, Algorithms and Applications, Springer Monographs in Mathematics, Springer, pp. 36–39, ISBN 978-1-84800- 998-1.

[7] Jungnickel, Dieter (2012), Graphs, Networks and Algorithms, Algorithms and Computation in Mathematics 5, Springer, pp. 92–93, ISBN 978-3-642-32278-5.

[8] Sedgewick, Robert; Wayne, Kevin (2011), “4,2,25 Unique topological ordering”, Algorithms (4th ed.), Addison-Wesley, pp. 598–599, ISBN 978-0-13-276256-4.

[9] Bender, Edward A.; Williamson, S. Gill (2005), “Example 26 (Linear extensions – topological sorts)", A Short Course in Discrete Mathematics, Dover Books on Computer Science, Courier Dover Publications, p. 142, ISBN 978-0-486-43946-4.

[10] Robinson, R. W. (1973), “Counting labeled acyclic digraphs”, in Harary, F., New Directions in the Theory of Graphs, Academic Press, pp. 239–273. See also Harary, Frank; Palmer, Edgar M. (1973), Graphical Enumeration, Academic Press, p. 19, ISBN 0-12-324245-2.

[11] Weisstein, Eric W., “Weisstein’s Conjecture”, MathWorld.

[12] McKay, B. D.; Royle, G. F.; Wanless, I. M.; Oggier, F. E.; Sloane, N. J. A.; Wilf, H. (2004), “Acyclic digraphs and eigenvalues of (0,1)-matrices”, Journal of Integer Sequences 7, Article 04.3.3. 3.4. REFERENCES 15

[13] Rebane, George; Pearl, Judea (1987), “The recovery of causal poly-trees from statistical data”, in Proc. 3rd Annual Con- ference on Uncertainty in Artificial Intelligence (UAI 1987), Seattle, WA, USA, July 1987 (PDF), pp. 222–228.

[14] Furnas, George W.; Zacks, Jeff (1994), “Multitrees: enriching and reusing hierarchical structure”, Proc. SIGCHI conference on Human Factors in Computing Systems (CHI '94), pp. 330–336, doi:10.1145/191666.191778.

[15] Cormen, Thomas H.; Leiserson, Charles E., Rivest, Ronald L., Stein, Clifford (2001) [1990]. Introduction to Algorithms (2nd ed.). MIT Press and McGraw-Hill. ISBN 0-262-03293-7. Section 22.4, Topological sort, pp. 549–552.

[16] Jungnickel (2012), pp. 50–51.

[17] For depth-first search based topological sorting algorithm, this validity check can be interleaved with the topological sorting algorithm itself; see e.g. Skiena, Steven S. (2009), The Algorithm Design Manual, Springer, pp. 179–181, ISBN 978-1- 84800-070-4.

[18] Stanley, Richard P. (1973), “Acyclic orientations of graphs”, Discrete Mathematics 5 (2): 171–178, doi:10.1016/0012- 365X(73)90108-8.

[19] Garey, Michael R.; Johnson, David S. (1979), Computers and Intractability: A Guide to the Theory of NP-Completeness, W. H. Freeman, ISBN 0-7167-1045-5, Problems GT7 and GT8, pp. 191–192.

[20] Harary, Frank; Norman, Robert Z.; Cartwright, Dorwin (1965), Structural Models: An Introduction to the Theory of Di- rected Graphs, John Wiley & Sons, p. 63.

[21] Skiena (2009), p. 495.

[22] Skiena (2009), p. 496.

[23] Bang-Jensen & Gutin (2008), p. 38.

[24] Picard, Jean-Claude (1976), “Maximal closure of a graph and applications to combinatorial problems”, Management Science 22 (11): 1268–1272, doi:10.1287/mnsc.22.11.1268, MR 0403596.

[25] Cormen et al. 2001, Section 24.2, Single-source shortest paths in directed acyclic graphs, pp. 592–595.

[26] Cormen et al. 2001, Sections 24.1, The Bellman–Ford algorithm, pp. 588–592, and 24.3, Dijkstra’s algorithm, pp. 595– 601.

[27] Cormen et al. 2001, p. 966.

[28] Skiena (2009), p. 469.

[29] Gross, Jonathan L.; Yellen, Jay; Zhang, Ping (2013), Handbook of Graph Theory (2nd ed.), CRC Press, p. 1181, ISBN 978-1-4398-8018-0.

[30] Srikant, Y. N.; Shankar, Priti (2007), The Compiler Design Handbook: Optimizations and Machine Code Generation, (2nd ed.), CRC Press, pp. 19–39, ISBN 978-1-4200-4383-9.

[31] Wang, John X. (2002), What Every Engineer Should Know About Decision Making Under Uncertainty, CRC Press, p. 160, ISBN 978-0-8247-4373-4.

[32] Sapatnekar, Sachin (2004), Timing, Springer, p. 133, ISBN 978-1-4020-7671-8.

[33] Dennis, Jack B. (1974), “First version of a data flow procedure language”, Programming Symposium, Lecture Notes in Computer Science 19, pp. 362–376, doi:10.1007/3-540-06859-7_145.

[34] Touati, Sid; de Dinechin, Benoit (2014), Advanced Backend Optimization, John Wiley & Sons, p. 123, ISBN 978-1-118- 64894-0.

[35] Gopnik, Alison; Schulz, Laura (2007), Causal Learning, , p. 4, ISBN 978-0-19-803928-0.

[36] Shmulevich, Ilya; Dougherty, Edward R. (2010), Probabilistic Boolean Networks: The Modeling and Control of Gene Reg- ulatory Networks, Society for Industrial and Applied Mathematics, p. 58, ISBN 978-0-89871-692-4.

[37] Cowell, Robert G.; Dawid, A. Philip; Lauritzen, Steffen L.; Spiegelhalter, David J. (1999), “3.2.1 Moralization”, Proba- bilistic Networks and Expert Systems, Springer, pp. 31–33, ISBN 0-387-98767-3.

[38] Dorf, Richard C. (1998), The Technology Management Handbook, CRC Press, p. 9-7, ISBN 978-0-8493-8577-3.

[39] Boslaugh, Sarah (2008), Encyclopedia of Epidemiology, Volume 1, SAGE, p. 255, ISBN 978-1-4129-2816-8. 16 CHAPTER 3. DIRECTED ACYCLIC GRAPH

[40] Pearl, Judea (1995). “Causal diagrams for empirical research”. Biometrika 82 (4): 669–709. doi:10.1093/biomet/82.4.669.

[41] “Bayesian network”.

[42] Kirkpatrick, Bonnie B. (April 2011), “Haplotypes versus genotypes on pedigrees”, Algorithms for Molecular Biology 6 (10), doi:10.1186/1748-7188-6-10, PMC 3102622, PMID 21504603.

[43] Bartlang, Udo (2010), Architecture and Methods for Flexible Content Management in Peer-to-Peer Systems, Springer, p. 59, ISBN 978-3-8348-9645-2.

[44] Pach, János; Sharir, Micha, Combinatorial Geometry and Its Algorithmic Applications: The Alcalá Lectures, Mathematical surveys and monographs 152, American Mathematical Society, pp. 93–94, ISBN 978-0-8218-7533-9.

[45] Crochemore, Maxime; Vérin, Renaud (1997), “Direct construction of compact directed acyclic word graphs”, Combina- torial Pattern Matching, Lecture Notes in Computer Science, Springer, pp. 116–129, doi:10.1007/3-540-63220-4_55.

[46] Lee, C. Y. (1959), “Representation of switching circuits by binary-decision programs”, Bell Systems Technical Journal 38: 985–999, doi:10.1002/j.1538-7305.1959.tb01585.x.

[47] Akers, Sheldon B. (1978), “Binary decision diagrams”, IEEE Transactions on Computers C–27 (6): 509–516, doi:10.1109/TC.1978.1675141.

3.5 External links

• Weisstein, Eric W., “Acyclic Digraph”, MathWorld. Chapter 4

Directed graph

A directed graph.

In mathematics, and more specifically in graph theory, a directed graph (or digraph) is a graph, or set of nodes connected by edges, where the edges have a direction associated with them. In formal terms, a digraph is a pair G = (V,A) (sometimes G = (V,E) ) of:[1]

• a set V, whose elements are called vertices or nodes, • a set A of ordered pairs of vertices, called arcs, directed edges, or arrows (and sometimes simply edges with

17 18 CHAPTER 4. DIRECTED GRAPH

a 1 b 1 2 3 4 a 1 0 1-1 4 3 2 b -1 1 0 0 c -1 1 00 d 0 0 0 -1 d c

Directed graph with corresponding incidence matrix.

the corresponding set named E instead of A).

It differs from an ordinary or undirected graph, in that the latter is defined in terms of unordered pairs of vertices, which are usually called edges. A digraph is called “simple” if it has no loops, and no multiple arcs (arcs with same starting and ending nodes). A directed multigraph, in which the arcs constitute a multiset, rather than a set, of ordered pairs of vertices may have loops (that is, “self-loops” with same starting and ending node) and multiple arcs. Some, but not all, texts allow a digraph, without the qualification simple, to have self loops, multiple arcs, or both.

4.1 Basic terminology

An arc e = (x, y) is considered to be directed from x to y ; y is called the head and x is called the tail of the arc; y is said to be a direct successor of x , and x is said to be a direct predecessor of y . If a path made up of one or more successive arcs leads from x to y , then y is said to be a successor of x , and x is said to be a predecessor of y . The arc (y, x) is called the arc (x, y) inverted. An orientation of a simple undirected graph is obtained by assigning a direction to each edge. Any directed graph constructed this way is called an “oriented graph”. A directed graph is an oriented simple graph if and only if it has neither self-loops nor 2-cycles.[2] A weighted digraph is a digraph with weights assigned to its arcs, similar to a weighted graph. In the context of graph theory a digraph with weighted edges is called a network. The adjacency matrix of a digraph (with loops and multiple arcs) is the integer-valued matrix with rows and columns corresponding to the nodes, where a nondiagonal entry aij is the number of arcs from node i to node j, and the diagonal entry aii is the number of loops at node i. The adjacency matrix of a digraph is unique up to identical permutation of rows and columns. Another matrix representation for a digraph is its incidence matrix. See direction for more definitions.

4.2 Indegree and outdegree

For a node, the number of head endpoints adjacent to a node is called the indegree of the node and the number of tail endpoints adjacent to a node is its outdegree (called "branching factor" in trees). 4.3. DEGREE SEQUENCE 19

A digraph with vertices labeled (indegree, outdegree)

Let G = (V, E) and v ∈ V, then the indegree is denoted deg−(v) and the outdegree as deg+(v). A vertex with deg−(v) = 0 is called a source, as it is the origin of each of its incident edges. Similarly, a vertex with deg+(v) = 0 is called a sink. The degree sum formula states that, for a directed graph,

∑ ∑ deg+(v) = deg−(v) = |E| . v∈V v∈V

If, for every node v ∈ V, we have deg+(v) = deg−(v) , the graph is called a balanced digraph.[3]

4.3 Degree sequence

The degree sequence of a directed graph is the list of its indegree and outdegree pairs; for the above example we have degree sequence ((2,0),(2,2),(0,2),(1,1)). The degree sequence is a directed graph invariant so isomorphic directed graphs have the same degree sequence. However, the degree sequence does not, in general, uniquely identify a graph; in some cases, non-isomorphic graphs have the same degree sequence. The digraph realization problem is the problem of finding a digraph with the degree sequence being a given sequence of positive integer pairs. (Trailing pairs of zeros may be ignored since they are trivially realized by adding an appro- priate number of isolated vertices to the digraph.) A sequence which is the degree sequence of some digraph, i.e. for which the digraph realization problem has a solution, is called a digraphic or digraphical sequence. This problem can either be solved by the Kleitman–Wang algorithm or by the Fulkerson–Chen–Anstee theorem.

4.4 Digraph connectivity

Main article: Connectivity (graph theory)

A digraph G is called weakly connected (or just connected[4]) if the undirected underlying graph obtained by replacing all directed edges of G with undirected edges is a connected graph. A digraph is strongly connected or strong if it 20 CHAPTER 4. DIRECTED GRAPH

contains a directed path from u to v and a directed path from v to u for every pair of vertices u,v. The strong components are the maximal strongly connected subgraphs.

4.5 Classes of digraphs

A directed graph G is called symmetric if, for every arc that belongs to G, the corresponding reversed arc also belongs to G. A symmetric, loopless directed graph is equivalent to an undirected graph with the edges replaced by pairs of inverse arcs; thus the number of edges is equal to the number of arcs halved.

5 7 3

11 8

2 9 10

A simple acyclic directed graph

An acyclic directed graph, acyclic digraph, or directed acyclic graph is a directed graph with no directed cycles. Special cases of acyclic directed graphs include multitrees (graphs in which no two directed paths from a single starting node meet back at the same ending node), oriented trees or (digraphs formed by orienting the edges of undirected acyclic graphs), and rooted trees (oriented trees in which all edges of the underlying undirected tree are directed away from the roots). A tournament is an oriented graph obtained by choosing a direction for each edge in an undirected complete graph. In the theory of Lie groups, a quiver Q is a directed graph serving as the domain of, and thus characterizing the shape of, a representation V defined as a functor, specifically an object of the functor category FinVctKF(Q) where F(Q) is the free category on Q consisting of paths in Q and FinVctK is the category of finite-dimensional vector spaces over a field K. Representations of a quiver label its vertices with vector spaces and its edges (and hence paths) compatibly with linear transformations between them, and transform via natural transformations. 4.6. SEE ALSO 21

1 2

3 4

A tournament on 4 vertices

4.6 See also

• Coates graph • Flow chart • • Flow graph (mathematics) • Mason graph • Oriented graph • • Quiver • Signal-flow graph • • Vertical constraint graph 22 CHAPTER 4. DIRECTED GRAPH

4.7 Notes

[1] Bang-Jensen & Gutin (2000). Diestel (2005), Section 1.10. Bondy & Murty (1976), Section 10.

[2] Diestel (2005), Section 1.10.

[3] Satyanarayana, Bhavanari; Prasad, Kuncham Syam, Discrete Mathematics and Graph Theory, PHI Learning Pvt. Ltd., p. 460, ISBN 978-81-203-3842-5; Brualdi, Richard A. (2006), Combinatorial matrix classes, Encyclopedia of mathematics and its applications 108, Cambridge University Press, p. 51, ISBN 978-0-521-86565-4.

[4] Bang-Jensen & Gutin (2000) p. 19 in the 2007 edition; p. 20 in the 2nd edition (2009).

4.8 References

• Bang-Jensen, Jørgen; Gutin, Gregory (2000), Digraphs: Theory, Algorithms and Applications, Springer, ISBN 1-85233-268-9 (the corrected 1st edition of 2007 is now freely available on the authors’ site; the 2nd edition appeared in 2009 ISBN 1-84800-997-6). • Bondy, John Adrian; Murty, U. S. R. (1976), Graph Theory with Applications, North-Holland, ISBN 0-444- 19451-7. • Diestel, Reinhard (2005), Graph Theory (3rd ed.), Springer, ISBN 3-540-26182-6 (the electronic 3rd edition is freely available on author’s site). • Harary, Frank; Norman, Robert Z.; Cartwright, Dorwin (1965), Structural Models: An Introduction to the Theory of Directed Graphs, New York: Wiley. • Number of directed graphs (or digraphs) with n nodes. Chapter 5

Orientation (graph theory)

In graph theory, an orientation of an undirected graph is an assignment of a direction to each edge, turning the initial graph into a directed graph.

5.1 Oriented graphs

A directed graph is called an oriented graph if it is the orientation of an undirected graph. Among directed graphs, the oriented graphs are the ones that have no self-loops, no multiple adjacencies, and no 2-cycles.[1] A tournament is an orientation of a complete graph.A polytree is an orientation of an undirected tree.[2] Sumner’s conjecture states that every tournament with 2n − 2 vertices contains every polytree with n vertices.[3] The number of non-isomorphic oriented graphs with n vertices (for n = 1, 2, 3, ...) is

1, 2, 7, 42, 582, 21480, 2142288, 575016219, 415939243032, ... (sequence A001174 in OEIS).

Oriented graphs are in one-to-one correspondence with complete directed graphs (graphs in which there is a directed edge in one or both directions between every pair of distinct vertices). A complete directed graph can be converted to an oriented graph by removing every 2-cycle, and conversely an oriented graph can be converted to a complete directed graph by adding a 2-cycle between every pair of vertices that are not endpoints of an edge; these correspondences are bijective. Therefore, the same sequence of numbers also solves the graph enumeration problem for complete digraphs. There is an explicit but complicated formula for the numbers in this sequence.[4]

5.2 Constrained orientations

A is an orientation that results in a strongly connected graph. The closely related totally cyclic orientations are orientations in which every edge belongs to at least one simple cycle. An orientation of an undirected graph G is totally cyclic if and only if it is a strong orientation of every connected component of G. Robbins’ theorem states that a graph has a strong orientation if and only if it is 2-edge-connected; disconnected graphs may have totally cyclic orientations, but only if they have no bridges.[5] An acyclic orientation is an orientation that results in a directed acyclic graph. Every graph has an acyclic orientation; all acyclic orientations may be obtained by placing the vertices into a sequence, and then directing each edge from the earlier of its endpoints in the sequence to the later endpoint. The Gallai–Hasse–Roy–Vitaver theorem states that a graph has an acyclic orientation in which the longest path has at most k vertices if and only if it can be colored with at most k colors.[6] Acyclic orientations and totally cyclic orientations are related to each other by planar duality. An acyclic orientation with a single source and a single sink is called a .[7] A transitive orientation is an orientation such that the resulting directed graph is its own transitive closure. The graphs with transitive orientations are called comparability graphs; they may be defined from a partially ordered set by making two elements adjacent whenever they are comparable in the partial order.[8] A transitive orientation, if one exists, can be found in linear time.[9] However, testing whether the resulting orientation (or any given orientation) is actually transitive requires more time, as it is equivalent in complexity to matrix multiplication.

23 24 CHAPTER 5. ORIENTATION (GRAPH THEORY)

An Eulerian orientation of an undirected graph is an orientation in which each vertex has equal in-degree and out- degree. Eulerian orientations of grid graphs arise in statistical mechanics in the theory of ice-type models.[10]

5.3 References

[1] Diestel, Reinhard (2005), “1.10 Other notions of graphs”, Graph Theory (PDF) (3rd ed.), Springer, ISBN 3-540-26182-6.

[2] Rebane, George; Pearl, Judea (1987), “The recovery of causal poly-trees from statistical data”, in Proc. 3rd Annual Con- ference on Uncertainty in Artificial Intelligence (UAI 1987), Seattle, WA, USA, July 1987 (PDF), pp. 222–228.

[3] Sumner’s Universal Tournament Conjecture, Douglas B. West, retrieved 2012-08-02.

[4] Harary, Frank; Palmer, Edgar M. (1973), “Formula 5.4.13”, Graphical Enumeration, New York: Academic Press, p. 133, MR 0357214.

[5] Robbins, H. E. (1939), “A theorem on graphs, with an application to a problem of traffic control”, The American Mathe- matical Monthly 46: 281–283, doi:10.2307/2303897.

[6] Nešetřil, Jaroslav; Ossona de Mendez, Patrice (2012), “Theorem 3.13”, Sparsity: Graphs, Structures, and Algorithms, Algo- rithms and Combinatorics 28, Heidelberg: Springer, p. 42, doi:10.1007/978-3-642-27875-4, ISBN 978-3-642-27874-7, MR 2920058.

[7] de Fraysseix, Hubert; de Mendez, Patrice Ossona; Rosenstiehl, Pierre (1995), “Bipolar orientations revisited”, Discrete Applied Mathematics 56 (2-3): 157–179, doi:10.1016/0166-218X(94)00085-R, MR 1318743.

[8] Ghouila-Houri, Alain (1962), “Caractérisation des graphes non orientés dont on peut orienter les arrêtes de manière à obtenir le graphe d'une relation d'ordre”, Les Comptes rendus de l'Académie des sciences 254: 1370–1371, MR 0172275.

[9] McConnell, R. M.; Spinrad, J. (1997), “Linear-time transitive orientation”, 8th ACM-SIAM Symposium on Discrete Algo- rithms, pp. 19–25.

[10] Mihail, Milena; Winkler, Peter (1992), “On the Number of Eularian Orientations of a Graph”, Proceedings of the Third Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '92, Philadelphia, PA, USA: Society for Industrial and Applied Mathematics, pp. 138–145, ISBN 0-89791-466-X.

5.4 External links

• Weisstein, Eric W., “Graph Orientation”, MathWorld. • Weisstein, Eric W., “Oriented Graph”, MathWorld. Chapter 6

Polytree

A B

C D E

F G H

I

A polytree

25 26 CHAPTER 6. POLYTREE

In mathematics, and more specifically in graph theory, a polytree[1] (also known as oriented tree[2][3] or singly connected network[4]) is a directed acyclic graph whose underlying undirected graph is a tree. In other words, if we replace its directed arcs with undirected edges, we obtain an undirected graph that is both connected and acyclic. A polytree is an example of oriented graph. The term polytree was coined in 1987 by Rebane and Pearl.[5]

6.1 Related structures

Every arborescence (a directed rooted tree, i.e. a directed acyclic graph in which there exists a single source node that has a unique path to every other node) is a polytree, but not every polytree is an arborescence. Every polytree is a multitree, a directed acyclic graph in which the subgraph reachable from any node forms a tree. The reachability relationship among the nodes of a polytree forms a partial order that has order dimension at most three. If the order dimension is three, there must exist a subset of seven elements x, yi, and zi (for i = 0, 1, 2) such that, for each i, either x ≤ yi ≥ zi, or x ≥ yi ≤ zi, with these six inequalities defining the polytree structure on these seven elements.[6] A fence or zigzag poset is a special case of a polytree in which the underlying tree is a path and the edges have orientations that alternate along the path. The reachability ordering in a polytree has also been called a generalized fence.[7]

6.2 Enumeration

The number of distinct polytrees on n unlabeled nodes, for n = 1, 2, 3, ..., is

1, 1, 3, 8, 27, 91, 350, 1376, 5743, 24635, 108968, 492180, ... (sequence A000238 in OEIS).

6.3 Sumner’s conjecture

Sumner’s conjecture, named after David Sumner, states that tournaments are universal graphs for polytrees, in the sense that every tournament with 2n − 2 vertices contains every polytree with n vertices as a subgraph. Although it remains unsolved, it has been proven for all sufficiently large values of n.[8]

6.4 Applications

Polytrees have been used as a for probabilistic reasoning.[1] If a Bayesian network has the structure of a polytree, then may be used to perform inference efficiently on it.[4][5] The contour tree of a real-valued function on a vector space is a polytree that describes the level sets of the function. The nodes of the contour tree are the level sets that pass through a critical point of the function and the edges describe contiguous sets of level sets without a critical point. The orientation of an edge is determined by the comparison between the function values on the corresponding two level sets.[9]

6.5 See also

• Glossary of graph theory

6.6 Notes

[1] Dasgupta (1999). 6.7. REFERENCES 27

[2] Harary & Sumner (1980).

[3] Simion (1991).

[4] Kim & Pearl (1983).

[5] Rebane & Pearl (1987).

[6] Trotter & Moore (1977).

[7] Ruskey, Frank (1989), “Transposition generation of alternating permutations”, Order 6 (3): 227–233, doi:10.1007/BF00563523, MR 1048093

[8] Kühn et al. (2011).

[9] Carr et al. (2000).

6.7 References

• Carr, Hamish; Snoeyink, Jack; Axen, Ulrike (2000), “Computing contour trees in all dimensions”, in Proc. 11th ACM-SIAM Symposium on Discrete Algorithms (SODA 2000), pp. 918–926 • Dasgupta, Sanjoy (1999), “Learning polytrees”, in Proc. 15th Conference on Uncertainty in Artificial Intelligence (UAI 1999), Stockholm, Sweden, July-August 1999 (PDF), pp. 134–141. • Harary, Frank; Sumner, David (1980), “The dichromatic number of an oriented tree”, Journal of Combina- torics, Information & System Sciences 5 (3): 184–187, MR 603363. • Kim, Jin H.; Pearl, Judea (1983), “A computational model for causal and diagnostic reasoning in inference en- gines”, in Proc. 8th International Joint Conference on Artificial Intelligence (IJCAI 1983), Karlsruhe, Germany, August 1983 (PDF), pp. 190–193.

• Kühn, Daniela; Mycroft, Richard; Osthus, Deryk (2011), “A proof of Sumner’s universal tournament conjec- ture for large tournaments”, Proceedings of the London Mathematical Society, Third Series 102 (4): 731–766, arXiv:1010.4430, doi:10.1112/plms/pdq035, MR 2793448. • Rebane, George; Pearl, Judea (1987), “The recovery of causal poly-trees from statistical data”, in Proc. 3rd Annual Conference on Uncertainty in Artificial Intelligence (UAI 1987), Seattle, WA, USA, July 1987 (PDF), pp. 222–228.

• Simion, Rodica (1991), “Trees with 1-factors and oriented trees”, Discrete Mathematics 88 (1): 93–104, doi:10.1016/0012-365X(91)90061-6, MR 1099270.

• Trotter, William T., Jr.; Moore, John I., Jr. (1977), “The dimension of planar posets”, Journal of Combinatorial Theory, Series B 22 (1): 54–67, doi:10.1016/0095-8956(77)90048-X. Chapter 7

Tournament (graph theory)

A tournament is a directed graph (digraph) obtained by assigning a direction for each edge in an undirected complete graph. That is, it is an orientation of a complete graph, or equivalently a directed graph in which every pair of distinct vertices is connected by a single directed edge. Many of the important properties of tournaments were first investigated by Landau in order to model dominance relations in flocks of chickens. Current applications of tournaments include the study of voting theory and social choice theory among other things. The name tournament originates from such a graph’s interpretation as the outcome of a round-robin tournament in which every player encounters every other player exactly once, and in which no draws occur. In the tournament digraph, the vertices correspond to the players. The edge between each pair of players is oriented from the winner to the loser. If player a beats player b , then it is said that a dominates b .

7.1 Paths and cycles

Any tournament on a finite number n of vertices contains a , i.e., directed path on all n vertices (Rédei 1934). This is easily shown by induction on n : suppose that the statement holds for n , and consider any tournament T on n + 1 vertices. Choose a vertex v0 of T and consider a directed path v1, v2, . . . , vn in T \{v0} . Now let i ∈ {0, . . . , n} be maximal such that for every j ≤ i there is a directed edge from vj to v0 .

v1, . . . , vi, v0, vi+1, . . . , vn is a directed path as desired. This argument also gives an algorithm for finding the Hamiltonian path. More efficient algorithms, that require examining only O(n log n) of the edges, are known.[1] This implies that a strongly connected tournament has a Hamiltonian cycle (Camion 1959). More strongly, every strongly connected tournament is vertex pancyclic: for each vertex v, and each k in the range from three to the number of vertices in the tournament, there is a cycle of length k containing v.[2] Moreover, if the tournament is 4‑connected, each pair of vertices can be connected with a Hamiltonian path (Thomassen 1980).

7.2 Transitivity

A tournament in which ((a → b) and (b → c)) ⇒ (a → c) is called transitive. In a transitive tournament, the vertices may be totally ordered by reachability.

7.2.1 Equivalent conditions

The following statements are equivalent for a tournament T on n vertices:

1. T is transitive.

28 7.2. TRANSITIVITY 29

2 5 3

1 8

7 6 4

A transitive tournament on 8 vertices.

2. T is acyclic.

3. T does not contain a cycle of length 3.

4. The score sequence (set of outdegrees) of T is {0,1,2,...,n − 1}.

5. T has exactly one Hamiltonian path.

7.2.2 Ramsey theory

Transitive tournaments play a role in Ramsey theory analogous to that of cliques in undirected graphs. In particular, ⌊ ⌋ [3] every tournament on n vertices contains a transitive subtournament on 1 + log2 n vertices. The proof is simple: choose any one vertex v to be part of this subtournament, and form the rest of the subtournament recursively on either the set of incoming neighbors of v or the set of outgoing neighbors of v, whichever is larger. For instance, every tournament on seven vertices contains a three-vertex transitive subtournament; the Paley tournament on seven vertices shows that this is the most that can be guaranteed (Erdős & Moser 1964). However, Reid & Parker (1970) showed that this bound is not tight for some larger values of n. Erdős & Moser (1964) proved that there are tournaments on n vertices without a transitive subtournament of size ⌊ ⌋ 2 + 2 log2 n Their proof uses a counting argument: the number of ways that a k-element transitive tournament can 30 CHAPTER 7. TOURNAMENT (GRAPH THEORY)

occur as a subtournament of a larger tournament on n labeled vertices is

( ) n n − k k!2(2) (2), k ⌊ ⌋ and when k is larger than 2+2 log2 n , this number is too small to allow for an occurrence of a transitive tournament n within each of the 2(2) different tournaments on the same set of n labeled vertices.

7.2.3 Paradoxical tournaments

A player who wins all games would naturally be the tournament’s winner. However, as the existence of non-transitive tournaments shows, there may not be such a player. A tournament for which every player loses at least one game is called a 1-paradoxical tournament. More generally, a tournament T=(V,E) is called k-paradoxical if for every k-element subset S of V there is a vertex v0 in V \ S such that v0 → v for all v ∈ S . By means of the probabilistic method, Paul Erdős showed that for any fixed value of k, if |V| ≥ k22kln(2 + o(1)), then almost every tournament on V is k-paradoxical.[4] On the other hand, an easy argument shows that any k-paradoxical tournament must have at least 2k+1 − 1 players, which was improved to (k + 2)2k−1 − 1 by Esther and George Szekeres (1965). There is an explicit construction of k-paradoxical tournaments with k24k−1(1 + o(1)) players by Graham and Spencer (1971) namely the Paley tournament.

7.2.4 Condensation

The condensation of any tournament is itself a transitive tournament. Thus, even for tournaments that are not transi- tive, the strongly connected components of the tournament may be totally ordered.[5]

7.3 Score sequences and score sets

The score sequence of a tournament is the nondecreasing sequence of outdegrees of the vertices of a tournament. The score set of a tournament is the set of integers that are the outdegrees of vertices in that tournament.

Landau’s Theorem (1953) A nondecreasing sequence of integers (s1, s2, ··· , sn) is a score sequence if and only if :

1. 0 ≤ s1 ≤ s2 ≤ · · · ≤ sn ( ) ··· ≥ i ··· − 2. s1 + s2 + + si 2 , for i = 1, 2, , n 1 ( ) ··· n 3. s1 + s2 + + sn = 2 .

Let s(n) be the number of different score sequences of size n . The sequence s(n) (sequence A000571 in OEIS) starts as: 1, 1, 1, 2, 4, 9, 22, 59, 167, 490, 1486, 4639, 14805, 48107, ... Winston and Kleitman proved that for sufficiently large n:

n − 5 s(n) > c14 n 2 ,

where c1 = 0.049. Takács later showed, using some reasonable but unproven assumptions, that

n − 5 s(n) < c24 n 2 ,

where c2 < 4.858. Together these provide evidence that: 7.4. SEE ALSO 31

n − 5 s(n) ∈ Θ(4 n 2 ).

Here Θ signifies an asymptotically tight bound. Yao showed that every nonempty set of nonnegative integers is the score set for some tournament.

7.4 See also

• Oriented graph • Paley tournament • Sumner’s conjecture

7.5 Notes

[1] Bar-Noy & Naor (1990).

[2] Moon (1966), Theorem 1.

[3] Erdős & Moser (1964).

[4] Erdős (1963).

[5] Harary & Moser (1966), Corollary 5b.

7.6 References

• Bar-Noy, A.; Naor, J. (1990), “Sorting, Minimal Feedback Sets and Hamilton Paths in Tournaments”, SIAM Journal on Discrete Mathematics 3 (1): 7–20, doi:10.1137/0403002. • Camion, Paul (1959), “Chemins et circuits hamiltoniens des graphes complets”, Comptes Rendus de l'Académie des Sciences de Paris 249: 2151–2152. • Erdős, P. (1963), “On a problem in graph theory” (PDF), The Mathematical Gazette 47: 220–223, JSTOR 3613396, MR 0159319. • Erdős, P.; Moser, L. (1964), “On the representation of directed graphs as unions of orderings” (PDF), Magyar Tud. Akad. Mat. Kutató Int. Közl. 9: 125–132, MR 0168494. • Graham, R. L.; Spencer, J. H. (1971), “A constructive solution to a tournament problem”, Canadian Mathe- matical Bulletin 14: 45–48, doi:10.4153/cmb-1971-007-1, MR 0292715. • Harary, Frank; Moser, Leo (1966), “The theory of round robin tournaments”, American Mathematical Monthly 73 (3): 231–246, doi:10.2307/2315334, JSTOR 2315334. • Landau, H.G. (1953), “On dominance relations and the structure of animal societies. III. The condition for a score structure”, Bulletin of Mathematical Biophysics 15 (2): 143–148, doi:10.1007/BF02476378. • Moon, J. W. (1966), “On subtournaments of a tournament”, Canadian Mathematical Bulletin 9 (3): 297–301, doi:10.4153/CMB-1966-038-7. • Rédei, László (1934), “Ein kombinatorischer Satz”, Acta Litteraria Szeged 7: 39–43. • Reid, K.B.; Parker, E.T. (1970), “Disproof of a conjecture of Erdös and Moser”, Journal of Combinatorial Theory 9 (3): 225–238, doi:10.1016/S0021-9800(70)80061-8. • Szekeres, E.; Szekeres, G. (1965), “On a problem of Schütte and Erdős”, The Mathematical Gazette 49: 290– 293, doi:10.2307/3612854, MR 0186566. 32 CHAPTER 7. TOURNAMENT (GRAPH THEORY)

• Takács, Lajos (1991), “A Bernoulli Excursion and Its Various Applications”, Advances in Applied Probability (Applied Probability Trust) 23 (3): 557–585, doi:10.2307/1427622, JSTOR 1427622. • Thomassen, Carsten (1980), “Hamiltonian-Connected Tournaments”, Journal of Combinatorial Theory, Series B 28 (2): 142–163, doi:10.1016/0095-8956(80)90061-1. • Yao, T.X. (1989), “On Reid conjecture of score sets for tournaments”, Chinese Sci. Bull. 34: 804–808.

This article incorporates material from tournament on PlanetMath, which is licensed under the Creative Commons Attribution/Share-Alike License. Chapter 8

Tree (graph theory)

In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree. A forest is a disjoint union of trees. The various kinds of data structures referred to as trees in computer science have underlying graphs that are trees in graph theory, although such data structures are generally rooted trees, thus in fact being directed graphs, and may also have additional ordering of branches. Rooted trees in their directed graph form may be called directed rooted trees.[1] Other terms for this include[2] arborescence,[3] out-arborescence,[4] out-tree,[3][5] and even branching.[3] The term “tree” was coined in 1857 by the British mathematician Arthur Cayley.[6]

8.1 Definitions

A tree is an undirected simple graph G that satisfies any of the following equivalent conditions:

• G is connected and has no cycles.

• G has no cycles, and a simple cycle is formed if any edge is added to G.

• G is connected, but is not connected if any single edge is removed from G.

• G is connected and the 3-vertex complete graph K3 is not a minor of G. • Any two vertices in G can be connected by a unique simple path.

If G has finitely many vertices, say n of them, then the above statements are also equivalent to any of the following conditions:

• G is connected and has n − 1 edges.

• G has no simple cycles and has n − 1 edges.

As elsewhere in graph theory, the order-zero graph (graph with no vertices) is generally excluded from consideration: while it is vacuously connected as a graph (any two vertices can be connected by a path), it is not 0-connected (or even (−1)-connected) in algebraic topology, unlike non-empty trees, and violates the “one more node than edges” relation. A leaf is a vertex of degree 1. An internal vertex is a vertex of degree at least 2. An irreducible (or series-reduced) tree is a tree in which there is no vertex of degree 2. A forest is an undirected graph, all of whose connected components are trees; in other words, the graph consists of a disjoint union of trees. Equivalently, a forest is an undirected cycle-free graph. As special cases, an empty graph,

33 34 CHAPTER 8. TREE (GRAPH THEORY)

a single tree, and the discrete graph on a set of vertices (that is, the graph with these vertices that has no edges), all are examples of forests. The term hedge sometimes refers to an ordered sequence of trees. A polytree[7] (also known as oriented tree[8][9] or singly connected network[10]) is a directed acyclic graph (DAG) whose underlying undirected graph is a tree. In other words, if we replace its directed arcs with undirected edges, we obtain an undirected graph that is both connected and acyclic. A directed tree is a directed graph which would be a tree if the directions on the edges were ignored, i.e. a polytree. Some authors restrict the phrase to the case where the edges are all directed towards a particular vertex, or all directed away from a particular vertex (see arborescence). A tree is called a rooted tree if one vertex has been designated the root, in which case the edges have a natural orientation, towards or away from the root. The tree-order is the partial ordering on the vertices of a tree with u ≤ v if and only if the unique path from the root to v passes through u. A rooted tree which is a subgraph of some graph G is a normal tree if the ends of every edge in G are comparable in this tree-order whenever those ends are vertices of the tree (Diestel 2005, p. 15). Rooted trees, often with additional structure such as ordering of the neighbors at each vertex, are a key data structure in computer science; see tree data structure. In a context where trees are supposed to have a root, a tree without any designated root is called a free tree. In a rooted tree, the parent of a vertex is the vertex connected to it on the path to the root; every vertex except the root has a unique parent. A child of a vertex v is a vertex of which v is the parent. A descendent of any vertex v is any vertex which is either the child of v or is (recursively) the descendent of any of the children of v.A sibling to a vertex v is any other vertex on the tree which has the same parent as v. A labeled tree is a tree in which each vertex is given a unique label. The vertices of a labeled tree on n vertices are typically given the labels 1, 2, …, n.A recursive tree is a labeled rooted tree where the vertex labels respect the tree order (i.e., if u < v for two vertices u and v, then the label of u is smaller than the label of v). A k-ary tree is a rooted tree for which each vertex has at most k children.[11] 2-ary trees are sometimes called binary trees, while 3-ary trees are sometimes called ternary trees. A terminal vertex of a tree is a vertex of degree 1. In a rooted tree, the leaves are all terminal vertices; additionally, the root, if not a leaf itself, is a terminal vertex if it has precisely one child.

8.1.1 Plane tree

An ordered tree or plane tree is a rooted tree for which an ordering is specified for the children of each vertex. This is called a “plane tree” because an ordering of the children is equivalent to an embedding of the tree in the plane, with the root at the top and the children of each vertex lower than that vertex. Given an embedding of a rooted tree in the plane, if one fixes a direction of children, say left to right, then an embedding gives an ordering of the children. Conversely, given an ordered tree, and conventionally drawing the root at the top, then the child nodes in an ordered tree can be drawn left-to-right, yielding an essentially unique planar embedding . A leaf in a rooted tree is a vertex of degree 1 that is not the root. A terminal vertex of a tree is a vertex of degree 1. In a rooted tree, the leaves are all terminal vertices; additionally, the root, if not a leaf itself, is a terminal vertex if it has precisely one child.

8.2 Example

The example tree shown above has 6 vertices and 6 − 1 = 5 edges. The unique simple path connecting the vertices 2 and 6 is 2-4-5-6.

8.3 Facts

• Every tree is a bipartite graph and a median graph. Every tree with only countably many vertices is a planar graph. 8.4. ENUMERATION 35

• Every connected graph G admits a , which is a tree that contains every vertex of G and whose edges are edges of G.

• Every connected graph with only countably many vertices admits a normal spanning tree (Diestel 2005, Prop. 8.2.4).

• There exist connected graphs with uncountably many vertices which do not admit a normal spanning tree (Diestel 2005, Prop. 8.5.2).

• Every finite tree with n vertices, with n > 1, has at least two terminal vertices (leaves). This minimal number of terminal vertices is characteristic of path graphs; the maximal number, n − 1, is attained by star graphs.

• For any three vertices in a tree, the three paths between them have exactly one vertex in common.

8.4 Enumeration

8.4.1 Labeled trees

Cayley’s formula states that there are nn−2 trees on n labeled vertices. It can be proved by first showing that the number of trees with vertices 1,2,...,n, of degrees d1,d2,...,dn respectively, is the multinomial coefficient

( ) n − 2 . d1 − 1, d2 − 1, . . . , dn − 1 An alternative proof uses Prüfer sequences. Cayley’s formula is the special case of complete graphs in a more general problem of counting spanning trees in an undirected graph, which is addressed by the matrix tree theorem. The similar problem of counting all the subtrees regardless of size has been shown to be #P-complete in the general case (Jerrum (1994)).

8.4.2 Unlabeled trees

Counting the number of unlabeled free trees is a harder problem. No closed formula for the number t(n) of trees with n vertices up to is known. The first few values of t(n) are:

1, 1, 1, 1, 2, 3, 6, 11, 23, 47, 106, 235, 551, 1301, 3159, ... (sequence A000055 in OEIS).

Otter (1948) proved the asymptotic estimate: t(n) ∼ Cαnn−5/2 asn → ∞, with the values C and α known to be approximately 0.534949606… and 2.95576528565… (sequence A051491 in OEIS), respectively. (Here, f ∼ g means that limn→∞ f/g = 1 .) This is a consequence of his asymptotic estimate for the number r(n) of unlabeled rooted trees with n vertices: r(n) ∼ Dαnn−3/2 asn → ∞, with D around 0.43992401257… and the same α as above (cf. Knuth (1997), Chap. 2.3.4.4 and Flajolet & Sedgewick (2009), Chap. VII.5, p. 475). The first few values of r(n) are:[12]

1, 1, 2, 4, 9, 20, 48, 115, 286, 719, 1842, 4766, 12486, 32973, ....

See also: Combinatorial species § Unlabelled structures 36 CHAPTER 8. TREE (GRAPH THEORY)

8.5 Types of trees

A star graph is a tree which consists of a single internal vertex (and n − 1 leaves). In other words, a star graph of order n is a tree of order n with as many leaves as possible. Its diameter is at most 2. A tree with two leaves (the fewest possible) is a ; a forest in which all components are isolated nodes and path graphs is called a linear forest. If all vertices in a tree are within distance one of a central path subgraph, then the tree is a caterpillar tree. If all vertices are within distance two of a central path subgraph, then the tree is a lobster.

8.6 See also

• Pseudoforest

• Tree structure

• Tree data structure

• Unrooted binary tree

8.7 Notes

[1] Stanley Gill Williamson (1985). Combinatorics for Computer Science. Courier Dover Publications. p. 288. ISBN 978-0- 486-42076-9.

[2] In particular, some authors consider that directed rooted trees are not descriptive enough as to the direction of the arcs, for instance Mehran Mesbahi; Magnus Egerstedt (2010). Graph Theoretic Methods in Multiagent Networks. Princeton University Press. p. 38. ISBN 1-4008-3535-6.

[3] Jonathan L. Gross; Jay Yellen; Ping Zhang (2013). Handbook of Graph Theory, Second Edition. CRC Press. p. 116. ISBN 978-1-4398-8018-0.

[4] Ding-Zhu Du; Ker-I Ko; Xiaodong Hu (2011). Design and Analysis of Approximation Algorithms. Springer Science & Business Media. p. 108. ISBN 978-1-4614-1701-9.

[5] Per Hage and (1996). Island Networks: Communication, Kinship, and Classification Structures in Oceania. Cambridge University Press. p. 43. ISBN 978-0-521-55232-5.

[6] Cayley (1857) “On the theory of the analytical forms called trees,” Philosophical Magazine, 4th series, 13 : 172–176. However it should be mentioned that in 1847, K.G.C. von Staudt, in his book Geometrie der Lage (Nürnberg, (Germany): Bauer und Raspe, 1847), presented a proof of Euler’s polyhedron theorem which relies on trees on pages 20–21. Also in 1847, the German physicist Gustav Kirchhoff investigated electrical circuits and found a relation between the number (n) of wires/resistors (branches), the number (m) of junctions (vertices), and the number (μ) of loops (faces) in the circuit. He proved the relation via an argument relying on trees. See: Kirchhoff, G. R. (1847) “Uber die Auflösung der Gleichungen auf welche man bei der Untersuchung der linearen Vertheilung galvanischer Ströme geführt wird” (On the solution of equations to which one is led by the investigation of the linear distribution of galvanic currents), Annalen der Physik und Chemie, 72 (12) : 497–508.

[7] See Dasgupta (1999).

[8] See Harary & Sumner (1980).

[9] See Simion (1991).

[10] See Kim & Pearl (1983).

[11] See Black, Paul E. (4 May 2007). “k-ary tree”. U.S. National Institute of Standards and Technology. Retrieved 8 February 2015.

[12] See Li (1996). 8.8. REFERENCES 37

8.8 References

• Dasgupta, Sanjoy (1999), “Learning polytrees”, in Proc. 15th Conference on Uncertainty in Artificial Intelligence (UAI 1999), Stockholm, Sweden, July–August 1999 (PDF), pp. 134–141. • Harary, Frank; Sumner, David (1980), “The dichromatic number of an oriented tree”, Journal of Combina- torics, Information & System Sciences 5 (3): 184–187, MR 603363.

• Kim, Jin H.; Pearl, Judea (1983), “A computational model for causal and diagnostic reasoning in inference en- gines”, in Proc. 8th International Joint Conference on Artificial Intelligence (IJCAI 1983), Karlsruhe, Germany, August 1983 (PDF), pp. 190–193. • Li, Gang (1996), “Generation of Rooted Trees and Free Trees”, M.S. Thesis, Dept. of Computer Science, University of Victoria, BC, Canada (PDF), p. 9. • Simion, Rodica (1991), “Trees with 1-factors and oriented trees”, Discrete Mathematics 88 (1): 93–104, doi:10.1016/0012-365X(91)90061-6, MR 1099270.

8.9 Further reading

• Diestel, Reinhard (2005), Graph Theory (3rd ed.), Berlin, New York: Springer-Verlag, ISBN 978-3-540- 26183-4. • Flajolet, Philippe; Sedgewick, Robert (2009), Analytic Combinatorics, Cambridge University Press, ISBN 978- 0-521-89806-5 • Hazewinkel, Michiel, ed. (2001), “Tree”, Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4

• Knuth, Donald E. (November 14, 1997), The Art of Computer Programming Volume 1: Fundamental Algo- rithms (3rd ed.), Addison-Wesley Professional

• Jerrum, Mark (1994), “Counting trees in a graph is #P-complete”, Information Processing Letters 51 (3): 111– 116, doi:10.1016/0020-0190(94)00085-9, ISSN 0020-0190.

• Otter, Richard (1948), “The Number of Trees”, Annals of Mathematics. Second Series 49 (3): 583–599, doi:10.2307/1969046, JSTOR 1969046. 38 CHAPTER 8. TREE (GRAPH THEORY)

8.10 Text and image sources, contributors, and licenses

8.10.1 Text • Connectivity (graph theory) Source: https://en.wikipedia.org/wiki/Connectivity_(graph_theory)?oldid=668565397 Contributors: Booy- abazooka, Kku, Meekohi, Pablo Mayrgundter, Dcoetzee, Zero0000, McKay, Kuszi, MathMartin, Bkell, Giftlite, Topaz, Paul August, Za- slav, Andygainey, Bkkbrad, Jwanders, Rjwilmsi, YurikBot, Mike.aizatsky, Bota47, RobertBorgersen, Wzhao553, Ignacioerrico, Chris the speller, JLeander, SMasters, JAnDbot, Turgidson, David Eppstein, JoergenB, Mihirpmehta, Maurice Carbonaro, Maproom, Potatoswat- ter, VolkovBot, PaulTanenbaum, Radagast3, SieBot, Wantnot, The Thing That Should Not Be, Watchduck, Bender2k14, C. lorenz, Ad- dbot, Cooldev.iitkgp, Vrajesh1989, Alex.mccarthy, Netzwerkerin, PV=nRT, Matěj Grabovský, Blaubner, Luckas-bot, Yobot, Tohd8BohaithuGh1, AnomieBOT, Ziyuang, Materialscientist, Twri, ArthurBot, Omnipaedista, Sophus Bie, Robykiwi~enwiki, Schmittz, Citation bot 1, JeromeGaltier, Itfollows, StraMic1000, ZéroBot, Sonicyouth86, El Roih, Not a similar name, BG19bot, Brad7777, Justincheng12345-bot, Makecat-bot, Lovegoodscience and Anonymous: 43 • Cycle (graph theory) Source: https://en.wikipedia.org/wiki/Cycle_(graph_theory)?oldid=667990993 Contributors: AxelBoldt, Tomo, Michael Hardy, Glenn, McKay, Altenmann, MathMartin, Giftlite, Vadmium, Uogl, Aegis Maelstrom, Drbreznjev, Oleg Alexandrov, Linas, LOL, Wavelength, SmackBot, InverseHypercube, DHN-bot~enwiki, Skadge, Uselesswarrior, Americanhero, David Eppstein, STBotD, BernardZ, Funandtrvl, Robert Samal, Ctxppc, PixelBot, Lartoven, Addbot, Ian Kelling, Twri, Xqbot, MastiBot, EmausBot, Kiatdd, Rcorcs, ChrisGualtieri, Monkbot and Anonymous: 22 • Directed acyclic graph Source: https://en.wikipedia.org/wiki/Directed_acyclic_graph?oldid=667264811 Contributors: Damian Yerrick, Bryan Derksen, Ap, Edward, Patrick, Michael Hardy, TakuyaMurata, Delirium, Dcoetzee, Doradus, Greenrd, StevePowell, Zero0000, Marc Girod~enwiki, Jaredwf, MathMartin, Henrygb, Wile E. Heresiarch, Giftlite, Eric S. Raymond, Esap, Mckaysalisbury, Watcher, Trevor MacInnis, Chris Howard, Oskar Sigvardsson, Smyth, Zaslav, MisterSheik, Kwamikagami, Jonon, Mpoloton, Homerjay, Kier- ano, Jesset77, Samohyl Jan, Oleg Alexandrov, Mindmatrix, Sartak, Rjwilmsi, Mathbot, Margosbot~enwiki, RexNL, NavarroJ, Vonkje, Midgley, Trovatore, Zwobot, Stephenbez, Mitchan, Brick Thrower, Kaaphi, Janmarthedal, Bluebot, Nbarth, Colonies Chris, Emre D., Radagast83, Sanya, Wren337, Comps, CRGreathouse, Epbr123, Hannes Eder, Tigga, Deflective, Andreas Toth, David Eppstein, C-sonic, Gambette, Pleasantville, Davehi1, Rei-bot, PaulTanenbaum, Ddxc, Mauritsmaartendejong, Kvihill, ClueBot, Roy.ba, Farisori, Addbot, Calculuslover, Yobot, TaBOT-zerem, Zat'n'ktel, Materialscientist, Frederic Y Bois, Twri, NoblerSavager, Kristjan.Jonasson, IcedNut, DoostdarWKP, Citation bot 1, DrilBot, RjwilmsiBot, SporkBot, AManWithNoPlan, Ort43v, Helpful Pixie Bot, BattyBot, YiFeiBot and Anonymous: 68 • Directed graph Source: https://en.wikipedia.org/wiki/Directed_graph?oldid=667034926 Contributors: Michael Hardy, Booyabazooka, Altenmann, Bkell, Giftlite, Vadmium, Andreas Kaufmann, Zaslav, Grue, Linas, SixWingedSeraph, Chobot, Wavelength, Stepa, Wook- ieInHeat, BiT, Nbarth, Delcypher, Meno25, Was a bee, Kozuch, Headbomb, Hamaryns, JAnDbot, Catgut, David Eppstein, R'n'B, Mar- cuse7~enwiki, M-le-mot-dit, Llorenzi, VolkovBot, HughD, Constant314, TXiKiBoT, Shauncutts, PaulTanenbaum, Rinix, Henry Delforn (old), Justin W Smith, JP.Martin-Flatin, Brews ohare, NuclearWarfare, MystBot, Addbot, Jarble, Luckas-bot, Ptbotgourou, Pcap, Calle, -Anne Bauval, Miym, Corruptcopper, Einkil, Mark Renier, Ricardo Fer ,آرمان ,Dzied Bulbash, Bryan.burgers, Twri, Ms.wiki.us, Xqbot reira de Oliveira, Pierre5018, EmausBot, WikitanvirBot, Sinuhe20, ChuispastonBot, Joerg Bader, Helpful Pixie Bot, Alesiom, Mark viking, Saranavan, Werddemer, SofjaKovalevskaja and Anonymous: 36 • Orientation (graph theory) Source: https://en.wikipedia.org/wiki/Orientation_(graph_theory)?oldid=608529513 Contributors: Rjwilmsi, David Eppstein, JP.Martin-Flatin and Yobot • Polytree Source: https://en.wikipedia.org/wiki/Polytree?oldid=641142721 Contributors: Michael Hardy, Charles Matthews, Doradus, Roachmeister, McKay, Giftlite, Andreas Kaufmann, Zaslav, Kundor, Oleg Alexandrov, LuisPedroCoelho, Jamarcus, SmackBot, Yeoil, Headbomb, MarshBot, David Eppstein, Squids and Chips, RatnimSnave, Kvihill, JP.Martin-Flatin, Addbot, Wireless friend, JakobVoss, Xqbot, RedBot, BG19bot, Dstjacques and Anonymous: 12 • Tournament (graph theory) Source: https://en.wikipedia.org/wiki/Tournament_(graph_theory)?oldid=657028153 Contributors: XJaM, Booyabazooka, Charles Matthews, McKay, Altenmann, MathMartin, Giftlite, Smjg, Rich Farmbrough, Paul August, Jnestorius, EmilJ, Rjwilmsi, YurikBot, Spiderboy, JohnWheater, Afrozenator, Kinthelt, Dreadstar, ArglebargleIV, Harrigan, Damelch, A3nm, David Epp- stein, Kope, Yecril, SoCalSuperEagle, Wantnot, DumZiBoT, Addbot, DOI bot, Yobot, AnomieBOT, Twri, Miym, MathsPoetry, Citation bot 1, DrilBot, 777sms, Dangling Reference, Svensvenerson, BattyBot, LRBH, Mateusz Konieczny and Anonymous: 26 • Tree (graph theory) Source: https://en.wikipedia.org/wiki/Tree_(graph_theory)?oldid=668874608 Contributors: AxelBoldt, Bryan Derk- sen, XJaM, Miguel~enwiki, Edemaine, Patrick, Michael Hardy, Booyabazooka, Dominus, Rp, Poor Yorick, Cherkash, Charles Matthews, Timwi, Andrevan, Dysprosia, Jitse Niesen, Doradus, Zero0000, McKay, Josh Cherry, Jaredwf, Altenmann, Kuszi, MathMartin, To- bias Bergemann, Tosha, Giftlite, Dbenbenn, Smjg, MSGJ, Neilc, Knutux, Zarvok, Almit39, Karl-Henner, Naerbnic, Andreas Kaufmann, PhotoBox, Gadykozma, Paul August, Zaslav, Kundor, Obradovic Goran, Mdd, Hippophaë~enwiki, Lssilva, Angr, Linas, Kzollman, Oded- Schramm, Adking80, Tizio, Salix alba, Arunkumar, Nguyen Thanh Quang, Maxal, Gurch, Algebraist, Debivort, Xcelerate, Michael Slone, Hyad, Bhny, Trovatore, Lt-wiki-bot, SmackBot, Sori, Bluebot, Nbarth, Vanished User 0001, Battamer, Sms97, Jon Awbrey, Lambiam, Breno, Wrstark, Physis, George100, Ylloh, Ezrakilty, Yaris678, Pjvpjv, Salgueiro~enwiki, Hermel, JAnDbot, Uv1234, 3D-Grabber, David Eppstein, Inhumandecency, Mihirpmehta, RaitisMath, MartinBot, R'n'B, N4nojohn, Mikhail Dvorkin, Policron, Sternkampf, Anonymous Dissident, Anna Lincoln, PaulTanenbaum, Spinningspark, SieBot, Cwkmail, Philly jawn, Justin W Smith, JP.Martin-Flatin, -Yobot, AnomieBOT, Ci ,سعی ,Dagh, Philippe Giabbanelli, Baudway, Libcub, Addbot, Topology Expert, Marsupilcoalt, NjardarBot tation bot, Twri, ArthurBot, Miym, GrouchoBot, Nicolas Perrault III, StaticVision, Citation bot 1, Ioakar, RedBot, DixonDBot, Xnn, EmausBot, ClueBot NG, Edelac, Helpful Pixie Bot, TricksterWolf, AvocatoBot, Victor Yus, Purdygb, Illia Connell, Frosty, Telfordbuck, JMP EAX, Kelvin Santarita, Zhirose, SentientSeaTurtle and Anonymous: 86

8.10.2 Images • File:4-tournament.svg Source: https://upload.wikimedia.org/wikipedia/commons/8/89/4-tournament.svg License: Public domain Con- tributors: Own work Original artist: Booyabazooka • File:8-tournament-transitive.svg Source: https://upload.wikimedia.org/wikipedia/commons/6/6c/8-tournament-transitive.svg License: Public domain Contributors: Own work Original artist: Booyabazooka 8.10. TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES 39

• File:Commons-logo.svg Source: https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg License: ? Contributors: ? Origi- nal artist: ? • File:Directed.svg Source: https://upload.wikimedia.org/wikipedia/commons/a/a2/Directed.svg License: Public domain Contributors: ? Original artist: ? • File:DirectedDegrees.svg Source: https://upload.wikimedia.org/wikipedia/commons/7/77/DirectedDegrees.svg License: GFDL Con- tributors: Own work Original artist: Melchoir • File:Directed_acyclic_graph_2.svg Source: https://upload.wikimedia.org/wikipedia/commons/0/03/Directed_acyclic_graph_2.svg Li- cense: Public domain Contributors: Own work Original artist: Johannes Rössel (talk) • File:Directed_acyclic_graph_3.svg Source: https://upload.wikimedia.org/wikipedia/commons/3/39/Directed_acyclic_graph_3.svg Li- cense: Public domain Contributors: • Directed_acyclic_graph_2.svg Original artist: Directed_acyclic_graph_2.svg: Johannes Rössel (talk) • File:Graph_cycle.gif Source: https://upload.wikimedia.org/wikipedia/commons/e/e7/Graph_cycle.gif License: CC BY-SA 3.0 Contrib- utors: Own work Original artist: Kiatdd • File:Hasse_diagram_of_powerset_of_3.svg Source: https://upload.wikimedia.org/wikipedia/commons/e/ea/Hasse_diagram_of_powerset_ of_3.svg License: CC-BY-SA-3.0 Contributors: self-made using graphviz's dot. Original artist: KSmrq • File:Incidence_matrix_-_directed_graph.svg Source: https://upload.wikimedia.org/wikipedia/commons/5/50/Incidence_matrix_-_directed_ graph.svg License: CC BY-SA 3.0 Contributors: Own work Original artist: Pistekjakub • File:Mergefrom.svg Source: https://upload.wikimedia.org/wikipedia/commons/0/0f/Mergefrom.svg License: Public domain Contribu- tors: ? Original artist: ? • File:Network_Community_Structure.svg Source: https://upload.wikimedia.org/wikipedia/commons/f/f4/Network_Community_Structure. svg License: CC BY-SA 3.0 Contributors: Own work Original artist: j_ham3 • File:Polytree.svg Source: https://upload.wikimedia.org/wikipedia/commons/6/61/Polytree.svg License: Public domain Contributors: Own work Original artist: [email protected]. Converted to SVG by Oleg Alexandrov 02:44, 3 August 2007 (UTC) • File:Question_book-new.svg Source: https://upload.wikimedia.org/wikipedia/en/9/99/Question_book-new.svg License: Cc-by-sa-3.0 Contributors: Created from scratch in Adobe Illustrator. Based on Image:Question book.png created by User:Equazcion Original artist: Tkgd2007 • File:Sample-graph.jpg Source: https://upload.wikimedia.org/wikipedia/commons/c/cb/Sample-graph.jpg License: CC BY 3.0 Con- tributors: Own work Original artist: Lovegoodscience • File:Speakerlink-new.svg Source: https://upload.wikimedia.org/wikipedia/commons/3/3b/Speakerlink-new.svg License: CC0 Contrib- utors: Own work Original artist: Kelvinsong • File:Tree_graph.svg Source: https://upload.wikimedia.org/wikipedia/commons/2/24/Tree_graph.svg License: Public domain Contrib- utors: ? Original artist: ? • File:UndirectedDegrees.svg Source: https://upload.wikimedia.org/wikipedia/commons/9/97/UndirectedDegrees.svg License: GFDL Contributors: Own work Original artist: Melchoir

8.10.3 Content license

• Creative Commons Attribution-Share Alike 3.0