In mathematics, and, in particular, in graph theory, a rooted graph is a graph in which one vertex has been distinguished as the root. Both directed and undirected versions of rooted graphs have been studied, and there are also variant definitions that allow multiple roots. Rooted graphs may also be known as pointed graphs or flow graphs. In some of the applications of these graphs, there is an additional requirement that the whole graph be reachable from the root vertex.
Variations
In topological graph theory, the notion of a rooted graph may be extended to consider multiple vertices or multiple edges as roots. The former are sometimes called vertex-rooted graphs in order to distinguish them from edge-rooted graphs in this context. Graphs with multiple nodes designated as roots are also of some interest in combinatorics, in the area of random graphs. These graphs are also called multiply rooted graphs. The terms rooted directed graph or rooted digraph also see variation in definitions. The obvious transplant is to consider a digraph rooted by identifying a particular node as root. However, in computer science, these terms commonly refer to a narrower notion, namely a rooted directed graph is a digraph with a distinguished node r, such that there is a directed path from r to any node other than r.. See in particular p. 524. Authors which give the more general definition, may refer to these as connected rooted digraphs. The Art of Computer Programming defines rooted digraphs slightly more broadly, namely a directed graph is called rooted if it has at least one node that can reach all the other nodes; Knuth notes that the notion thus defined is a sort of intermediate between the notions of strongly connected and connected digraph.
Applications
Flow graphs
In computer science, rooted graphs in which the root vertex can reach all other vertices are called flow graphs or flowgraphs. Sometimes an additional restriction is added specifying that a flow graph must have a single exit vertex as well. Flow graphs may be viewed as abstractions of flow charts, with the non-structural elements removed. Perhaps the best known sub-class of flow graphs are control flow graphs, used in compilers and program analysis. An arbitrary flow graph may converted to a control flow graph by performing an edge contraction on every edge that is the only outgoing edge from its source and the only incoming edge into its target. Another type of flow graph commonly used is the call graph, in which nodes correspond to entire subroutines. The general notion of flow graph has been called program graph, but the same term has also been used to denote only control flow graphs. Flow graphs have also been called unlabeled flowgraphs, and proper flowgraphs. These graphs are sometimes used in software testing. When required to have a single exit, flow graphs have two properties not shared with directed graphs in general. Flow graphs can be nested, which is the equivalent of a subroutine call, and flow graphs can also be sequenced, which is the equivalent of sequential execution of two pieces of code. Prime flow graphs are defined as flow graphs that cannot be decomposed via nesting or sequencing using a chosen pattern of subgraphs, for example the primitives of structured programming. Theoretical research has been done on determining, for example, the proportion of prime flow graphs given a chosen set of graphs.
Set theory
has used rooted directed graphs such that every node is reachable from the root to formulate Aczel's anti-foundation axiom in non-well-founded set theory. In this context, each vertex of an accessible pointed graph models a set within Aczel's non-well-foundet set theory, and an arc from a vertex v to a vertex w models that v is an element of w. Aczel's anti-foundation axiom states that every accessible pointed graph models a family of sets in this way.
Given a purely combinatorial game, there is an associated rooted directed graph whose vertices are game positions and whose edges are moves, and graph traversal starting from the root is used to create a game tree. If the graph contains directed cycles, then a position in the game could repeat infinitely many times, and rules are usually needed to prevent the game from continuing indefinitely. Otherwise, the graph is a directed acyclic graph, and if it isn't a rooted tree, then the game has transpositions. This graph and its topology is important in the study of game complexity, where the state-space complexity is the number of vertices in the graph, the average game length is the average number of vertices traversed from the root to a vertex with no direct successors, and the average branching factor of a game tree is the average outdegree of the graph.
Combinatorial enumeration
The number of rooted undirected graphs for 1, 2,... nodes is 1, 2, 6, 20, 90, 544,...
Related concepts
A special case of interest are rooted trees, the trees with a distinguished root vertex. If the directed paths from the root in the rooted digraph are additionally restricted to be unique, then the notion obtained is that of arborescence—the directed-graph equivalent of a rooted tree. A rooted graph contains an arborescence with the same root if and only if the whole graph can be reached from the root, and computer scientists have studied algorithmic problems of finding optimal arborescences. Rooted graphs may be combined using the rooted product of graphs.