In
mathematics
Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, and, in particular, in
graph theory
In mathematics and computer science, graph theory is the study of ''graph (discrete mathematics), graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of ''Vertex (graph ...
, a rooted graph is a
graph
Graph may refer to:
Mathematics
*Graph (discrete mathematics), a structure made of vertices and edges
**Graph theory, the study of such graphs and their properties
*Graph (topology), a topological space resembling a graph in the sense of discret ...
in which one
vertex has been distinguished as the root. Both
directed
Direct may refer to:
Mathematics
* Directed set, in order theory
* Direct limit of (pre), sheaves
* Direct sum of modules, a construction in abstract algebra which combines several vector spaces
Computing
* Direct access (disambiguation), a ...
and
undirected
In discrete mathematics, particularly in graph theory, a graph is a structure consisting of a set of objects where some pairs of the objects are in some sense "related". The objects are represented by abstractions called '' vertices'' (also call ...
versions of rooted graphs have been studied, and there are also variant definitions that allow multiple roots.

Rooted graphs may also be known (depending on their application) 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
In mathematics, topological graph theory is a branch of graph theory. It studies the embedding of graphs in surfaces, spatial embeddings of graphs, and graphs as topological spaces. It also studies immersions of graphs.
Embedding a graph in ...
, 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
Combinatorics is an area of mathematics primarily concerned with counting, both as a means and as an end to obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many ...
, in the area of
random graphs
In mathematics, random graph is the general term to refer to probability distributions over Graph (discrete mathematics), graphs. Random graphs may be described simply by a probability distribution, or by a random process which generates them. ...
. 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.
[ See in particular p. 307.] However, in
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied 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''. Authors who give the more general definition may refer to graphs meeting the narrower definition as ''connected'' rooted digraphs
or ''accessible'' rooted graphs (see ).
''
The Art of Computer Programming
''The Art of Computer Programming'' (''TAOCP'') is a comprehensive multi-volume monograph written by the computer scientist Donald Knuth presenting programming algorithms and their analysis. it consists of published volumes 1, 2, 3, 4A, and 4 ...
'' 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
In the mathematical theory of directed graphs, a graph is said to be strongly connected if every vertex is reachable from every other vertex. The strongly connected components of a directed graph form a partition into subgraphs that are thems ...
and
connected digraph.
Applications
Flow graphs
In
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied 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 (
sink
A sink (also known as ''basin'' in the UK) is a bowl-shaped plumbing fixture for washing hands, dishwashing, and other purposes. Sinks have a tap (faucet) that supplies hot and cold water and may include a spray feature to be used for fas ...
) vertex.
Flow graphs may be viewed as
abstraction
Abstraction is a process where general rules and concepts are derived from the use and classifying of specific examples, literal (reality, real or Abstract and concrete, concrete) signifiers, first principles, or other methods.
"An abstraction" ...
s of
flow chart
A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.
The flowchart shows the steps as boxes of va ...
s, with the non-structural elements (node contents and types) removed.
Perhaps the best known sub-class of flow graphs are
control-flow graph
In computer science, a control-flow graph (CFG) is a representation, using graph notation, of all paths that might be traversed through a program during its execution. The control-flow graph was conceived by Frances E. Allen, who noted that ...
s, used in
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
s and
program analysis
In computer science, program analysis is the process of analyzing the behavior of computer programs regarding a property such as correctness, robustness, safety and liveness.
Program analysis focuses on two major areas: program optimization an ...
. An arbitrary flow graph may be converted to a control-flow graph by performing an
edge contraction
In graph theory, an edge contraction is an operation that removes an edge from a graph while simultaneously merging the two vertices that it previously joined. Edge contraction is a fundamental operation in the theory of graph minors. Vertex id ...
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
A call graph (also known as a call multigraph) is a control-flow graph, which represents calling relationships between subroutines in a computer program. Each node represents a procedure and each edge ''(f, g)'' indicates that procedure ''f'' c ...
, in which nodes correspond to entire
subroutine
In computer programming, a function (also procedure, method, subroutine, routine, or subprogram) is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times.
Callable units provide a ...
s.
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
Software testing is the act of checking whether software satisfies expectations.
Software testing can provide objective, independent information about the Quality (business), quality of software and the risk of its failure to a User (computin ...
.
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 (although there is no notion of passing parameters), 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 Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making specific disciplined use of the structured control flow constructs of selection ( if/then/else) and repet ...
. Theoretical research has been done on determining, for example, the proportion of prime flow graphs given a chosen set of graphs.
Set theory
Peter Aczel
Peter Henry George Aczel (; 31 October 1941 – 1 August 2023) was a British mathematician, logician and Emeritus joint Professor in the Department of Computer Science and the School of Mathematics at the University of Manchester. He is known f ...
has used rooted directed graphs such that every node is reachable from the root (which he calls accessible pointed graphs) to formulate
Aczel's anti-foundation axiom
In the foundations of mathematics, Aczel's anti-foundation axiom is an axiom set forth by , as an alternative to the axiom of foundation in Zermelo–Fraenkel set theory. It states that every accessible pointed directed graph corresponds to exac ...
in
non-well-founded set theory
Non-well-founded set theories are variants of axiomatic set theory that allow sets to be elements of themselves and otherwise violate the rule of well-foundedness. In non-well-founded set theories, the foundation axiom of ZFC is replaced by axio ...
. In this context, each vertex of an accessible pointed graph models a (non-well-founded) set within Aczel's (non-well-founded) 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
In the foundations of mathematics, Aczel's anti-foundation axiom is an axiom set forth by , as an alternative to the axiom of foundation in Zermelo–Fraenkel set theory. It states that every accessible pointed directed graph corresponds to exac ...
states that every accessible pointed graph models a family of (non-well-founded) sets in this way.
Combinatorial game theory
Any
combinatorial
Combinatorics is an area of mathematics primarily concerned with counting, both as a means and as an end to obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many ...
game
A game is a structured type of play usually undertaken for entertainment or fun, and sometimes used as an educational tool. Many games are also considered to be work (such as professional players of spectator sports or video games) or art ...
, can be associated with a rooted directed graph whose vertices are game positions, whose edges are moves, and whose root is the starting position of the game. This graph is important in the study of
game complexity
Combinatorial game theory measures game complexity in several ways:
#State-space complexity (the number of legal game positions from the initial position)
#Game tree size (total number of possible games)
#Decision complexity (number of leaf nod ...
, where the
state-space complexity
In computer science, a state space is a discrete space representing the set of all possible configurations of a system. It is a useful abstraction for reasoning about the behavior of a given system and is widely used in the fields of artificial ...
is the number of vertices in 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 tree
In graph theory, a tree is an undirected graph in which any two vertices are connected by path, or equivalently a connected acyclic undirected graph. A forest is an undirected graph in which any two vertices are connected by path, or equi ...
s, the
trees
In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, e.g., including only woody plants with secondary growth, only p ...
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 (rooted)
arborescence
Arborescence refers to any tree-like structure. It may also refer to:
* Arborescence (graph theory)
* ''Arborescence'' (album), a 1994 album by Ozric Tentacles
* ''Arborescence'', a 2013 album by Aaron Parks
{{disambiguation ...
—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
In mathematical graph theory, the rooted product of a graph and a rooted graph is defined as follows: take copies of , and for every vertex of , identify with the root node of the -th copy of .
More formally, assuming that
:\begin
V(G) &= ...
.
See also
*
k-vertex-connected graph
In graph theory, a connected Graph (discrete mathematics), graph is said to be -vertex-connected (or -connected) if it has more than Vertex (graph theory), vertices and remains Connectivity (graph theory), connected whenever fewer than vertic ...
*
pointed set
In mathematics, a pointed set (also based set or rooted set) is an ordered pair (X, x_0) where X is a Set (mathematics), set and x_0 is an element of X called the base point (also spelled basepoint).
Map (mathematics), Maps between pointed sets ...
References
Further reading
*
*
External links
*{{mathworld, title=Rooted Graph, urlname=RootedGraph, mode=cs2
Extensions and generalizations of graphs