In
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, and, in particular, in
graph theory
In mathematics, graph theory is the study of ''graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of '' vertices'' (also called ''nodes'' or ''points'') which are conne ...
, 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 discre ...
in which one
vertex
Vertex, vertices or vertexes may refer to:
Science and technology Mathematics and computer science
*Vertex (geometry), a point where two or more curves, lines, or edges meet
* Vertex (computer graphics), a data structure that describes the positio ...
has been distinguished as the root. Both
directed
Director may refer to:
Literature
* ''Director'' (magazine), a British magazine
* ''The Director'' (novel), a 1971 novel by Henry Denker
* ''The Director'' (play), a 2000 play by Nancy Hasty
Music
* Director (band), an Irish rock band
* ''D ...
and
undirected
In discrete mathematics, and more specifically in graph theory, a graph is a structure amounting to a set of objects in which some pairs of the objects are in some sense "related". The objects correspond to mathematical abstractions called '' v ...
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 an end in obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many appl ...
, in the area of
random graphs
In mathematics, random graph is the general term to refer to probability distributions over graphs. Random graphs may be described simply by a probability distribution, or by a random process which generates them. The theory of random graphs ...
. These graphs are also called multiply rooted graphs.
The terms rooted
directed graph
In mathematics, and more specifically in graph theory, a directed graph (or digraph) is a graph that is made up of a set of vertices connected by directed edges, often called arcs.
Definition
In formal terms, a directed graph is an ordered pa ...
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, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, 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 which give the more general definition, may refer to these as ''connected'' rooted digraphs,
or ''accessible'' rooted graphs (see ).
''
The Art of Computer Programming
''The Art of Computer Programming'' (''TAOCP'') is a comprehensive monograph written by the computer scientist Donald Knuth presenting programming algorithms and their analysis. Volumes 1–5 are intended to represent the central core of compu ...
'' 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 an arbitrary directed graph form a partition into subgraphs that ...
and
connected digraph.
Applications
Flow graphs
In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, 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 is a bowl-shaped plumbing fixture for washing hands, dishwashing, and other purposes. Sinks have a tap (faucet) that supply hot and cold water and may include a spray feature to be used for faster rinsing. They also include a drain t ...
) vertex as well.
Flow graphs may be viewed as
abstraction
Abstraction in its main sense is a conceptual process wherein general rules and concepts are derived from the usage and classification of specific examples, literal ("real" or "concrete") signifiers, first principles, or other methods.
"An abstr ...
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 discovered by Frances E. Allen, who noted that ...
s, used in
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
s and
program analysis
In computer science, program analysis is the process of automatically analyzing the behavior of computer programs regarding a property such as correctness, robustness, safety and liveness.
Program analysis focuses on two major areas: program op ...
. 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 ide ...
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'' cal ...
, in which nodes correspond to entire
subroutine
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Functions may ...
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 examining the artifacts and the behavior of the software under test by validation and verification. Software testing can also provide an objective, independent view of the software to allow the business to apprecia ...
.
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 extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
. 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 (; born 31 October 1941) is 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 for his work in ...
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 exa ...
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 exa ...
states that every accessible pointed graph models a family of (non-well-founded) sets in this way.
Combinatorial game theory
Given a purely
combinatorial
Combinatorics is an area of mathematics primarily concerned with counting, both as a means and an end in obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many ap ...
game
A game is a structured form of play (activity), play, usually undertaken for enjoyment, entertainment or fun, and sometimes used as an educational tool. Many games are also considered to be work (such as professional players of spectator s ...
, there is an associated rooted directed graph whose vertices are game positions and whose edges are moves, and
graph traversal
In computer science, graph traversal (also known as graph search) refers to the process of visiting (checking and/or updating) each vertex in a graph. Such traversals are classified by the order in which the vertices are visited. Tree traversal ...
starting from the root is used to create a
game tree
In the context of Combinatorial game theory, which typically studies sequential games with perfect information, a game tree is a graph representing all possible game states within such a game. Such games include well-known ones such as chess, check ...
. If the graph contains
directed cycle
Director may refer to:
Literature
* ''Director'' (magazine), a British magazine
* ''The Director'' (novel), a 1971 novel by Henry Denker
* ''The Director'' (play), a 2000 play by Nancy Hasty
Music
* Director (band), an Irish rock band
* ''D ...
s, then a position in the game could repeat infinitely many times, and
rules
Rule or ruling may refer to:
Education
* Royal University of Law and Economics (RULE), a university in Cambodia
Human activity
* The exercise of political or personal control by someone with authority or power
* Business rule, a rule pert ...
are usually needed to prevent the game from continuing indefinitely. Otherwise, the graph is a
directed acyclic graph
In mathematics, particularly graph theory, and computer science, a directed acyclic graph (DAG) is a directed graph with no directed cycles. That is, it consists of vertices and edges (also called ''arcs''), with each edge directed from one ve ...
, and if it isn't a
rooted tree
In graph theory, a tree is an undirected graph in which any two vertices are connected by ''exactly one'' path, or equivalently a connected acyclic undirected graph. A forest is an undirected graph in which any two vertices are connected by ''a ...
, then the game has
transpositions. This graph and its
topology
In mathematics, topology (from the Greek language, Greek words , and ) is concerned with the properties of a mathematical object, geometric object that are preserved under Continuous function, continuous Deformation theory, deformations, such ...
is important in the study of
game complexity
Combinatorial game theory has several ways of measuring game complexity. This article describes five of them: state-space complexity, game tree size, decision complexity, game-tree complexity, and computational complexity.
Measures of game comple ...
, where the
state-space complexity
A state space is 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 intelligence and game theory.
For instance, the toy ...
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
In computing, tree data structures, and game theory, the branching factor is the number of children at each node, the outdegree. If this value is not uniform, an ''average branching factor'' can be calculated.
For example, in chess, if a "node" i ...
of a game tree is the average
outdegree
In mathematics, and more specifically in graph theory, a directed graph (or digraph) is a graph that is made up of a set of vertices connected by directed edges, often called arcs.
Definition
In formal terms, a directed graph is an ordered pai ...
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 tree
In graph theory, a tree is an undirected graph in which any two vertices are connected by ''exactly one'' path, or equivalently a connected acyclic undirected graph. A forest is an undirected graph in which any two vertices are connected by ''a ...
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, including only woody plants with secondary growth, plants that are u ...
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—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 ''G'' and a rooted graph ''H'' is defined as follows: take , ''V''(''G''), copies of ''H'', and for every vertex v_i of ''G'', identify v_i with the root node of the ''i''-th copy of ''H' ...
.
See also
*
k-vertex-connected graph
In graph theory, a connected graph is said to be -vertex-connected (or -connected) if it has more than vertices and remains connected whenever fewer than vertices are removed.
The vertex-connectivity, or just connectivity, of a graph is the ...
*
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 and x_0 is an element of X called the base point, also spelled basepoint.
Maps between pointed sets (X, x_0) and (Y, y_0) – called based ma ...
References
Further reading
*
*
External links
*{{mathworld, title=Rooted Graph, urlname=RootedGraph, mode=cs2
Extensions and generalizations of graphs