
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 conn ...
, a branch of mathematics, the triconnected components of a
biconnected graph are a system of smaller graphs that describe all of the 2-vertex cuts in the graph. An SPQR tree is a
tree data structure used 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 practical disciplines (includin ...
, and more specifically
graph algorithms, to represent the triconnected components of a graph. The SPQR tree of a graph may be constructed in
linear time[; .] and has several applications in
dynamic graph algorithm
Dynamics (from Greek δυναμικός ''dynamikos'' "powerful", from δύναμις ''dynamis'' " power") or dynamic may refer to:
Physics and engineering
* Dynamics (mechanics)
** Aerodynamics, the study of the motion of air
** Analytical dyn ...
s and
graph drawing
Graph drawing is an area of mathematics and computer science combining methods from geometric graph theory and information visualization to derive two-dimensional depictions of graphs arising from applications such as social network analysis, car ...
.
The basic structures underlying the SPQR tree, the triconnected components of a graph, and the connection between this decomposition and the planar embeddings of a
planar graph
In graph theory, a planar graph is a graph that can be embedded in the plane, i.e., it can be drawn on the plane in such a way that its edges intersect only at their endpoints. In other words, it can be drawn in such a way that no edges cro ...
, were first investigated by ; these structures were used in efficient algorithms by several other researchers
[E.g., and , both of which are cited as precedents by Di Battista and Tamassia.] prior to their formalization as the SPQR tree by .
Structure
An SPQR tree takes the form of an
unrooted tree in which for each node ''x'' there is associated an
undirected graph
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 ...
or
multigraph
In mathematics, and more specifically in graph theory, a multigraph is a graph which is permitted to have multiple edges (also called ''parallel edges''), that is, edges that have the same end nodes. Thus two vertices may be connected by mo ...
''G''
''x''. The node, and the graph associated with it, may have one of four types, given the initials SPQR:
* In an S node, the associated graph is a
cycle graph
In graph theory, a cycle graph or circular graph is a graph that consists of a single cycle, or in other words, some number of vertices (at least 3, if the graph is simple) connected in a closed chain. The cycle graph with vertices is called ...
with three or more vertices and edges. This case is analogous to series composition in
series–parallel graph
In graph theory, series–parallel graphs are graphs with two distinguished vertices called ''terminals'', formed recursively by two simple composition operations. They can be used to model series and parallel electric circuits.
Definition and t ...
s; the S stands for "series".
[.]
* In a P node, the associated graph is a
dipole graph
In graph theory, a dipole graph, dipole, bond graph, or linkage, is a multigraph consisting of two vertices connected with a number of parallel edges. A dipole graph containing edges is called the dipole graph, and is denoted by . The dipole ...
, a multigraph with two vertices and three or more edges, the
planar dual
In the mathematical discipline of graph theory, the dual graph of a plane graph is a graph that has a vertex for each face of . The dual graph has an edge for each pair of faces in that are separated from each other by an edge, and a self-loop ...
to a cycle graph. This case is analogous to parallel composition in
series–parallel graph
In graph theory, series–parallel graphs are graphs with two distinguished vertices called ''terminals'', formed recursively by two simple composition operations. They can be used to model series and parallel electric circuits.
Definition and t ...
s; the P stands for "parallel".
* In a Q node, the associated graph has a single real edge. This trivial case is necessary to handle the graph that has only one edge. In some works on SPQR trees, this type of node does not appear in the SPQR trees of graphs with more than one edge; in other works, all non-virtual edges are required to be represented by Q nodes with one real and one virtual edge, and the edges in the other node types must all be virtual.
* In an R node, the associated graph is a 3-connected graph that is not a cycle or dipole. The R stands for "rigid": in the application of SPQR trees in planar graph embedding, the associated graph of an R node has a unique planar embedding.
Each edge ''xy'' between two nodes of the SPQR tree is associated with two directed ''virtual edges'', one of which is an edge in ''G
x'' and the other of which is an edge in ''G
y''. Each edge in a graph ''G
x'' may be a virtual edge for at most one SPQR tree edge.
An SPQR tree ''T'' represents a 2-connected graph ''G
T'', formed as follows. Whenever SPQR tree edge ''xy'' associates the virtual edge ''ab'' of ''G
x'' with the virtual edge ''cd'' of ''G
y'', form a single larger graph by merging ''a'' and ''c'' into a single supervertex, merging ''b'' and ''d'' into another single supervertex, and deleting the two virtual edges. That is, the larger graph is the
2-clique-sum of ''G
x'' and ''G
y''. Performing this gluing step on each edge of the SPQR tree produces the graph ''G
T''; the order of performing the gluing steps does not affect the result. Each vertex in one of the graphs ''G
x'' may be associated in this way with a unique vertex in ''G
T'', the supervertex into which it was merged.
Typically, it is not allowed within an SPQR tree for two S nodes to be adjacent, nor for two P nodes to be adjacent, because if such an adjacency occurred the two nodes could be merged into a single larger node. With this assumption, the SPQR tree is uniquely determined from its graph. When a graph ''G'' is represented by an SPQR tree with no adjacent P nodes and no adjacent S nodes, then the graphs ''G''
''x'' associated with the nodes of the SPQR tree are known as the triconnected components of ''G''.
Construction
The SPQR tree of a given 2-vertex-connected graph can be constructed in
linear time.
The problem of constructing the triconnected components of a graph was first solved in linear time by . Based on this algorithm, suggested that the full SPQR tree structure, and not just the list of components, should be constructible in linear time. After an implementation of a slower algorithm for SPQR trees was provided as part of the GDToolkit library, provided the first linear-time implementation. As part of this process of implementing this algorithm, they also corrected some errors in the earlier work of .
The algorithm of includes the following overall steps.
# Sort the edges of the graph by the pairs of numerical indices of their endpoints, using a variant of
radix sort
In computer science, radix sort is a non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their radix. For elements with more than one significant digit, this bucketing process ...
that makes two passes of
bucket sort
Bucket sort, or bin sort, is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the b ...
, one for each endpoint. After this sorting step, parallel edges between the same two vertices will be adjacent to each other in the sorted list and can be split off into a P-node of the eventual SPQR tree, leaving the remaining graph simple.
# Partition the graph into split components; these are graphs that can be formed by finding a pair of separating vertices, splitting the graph at these two vertices into two smaller graphs (with a linked pair of virtual edges having the separating vertices as endpoints), and repeating this splitting process until no more separating pairs exist. The partition found in this way is not uniquely defined, because the parts of the graph that should become S-nodes of the SPQR tree will be subdivided into multiple triangles.
# Label each split component with a P (a two-vertex split component with multiple edges), an S (a split component in the form of a triangle), or an R (any other split component). While there exist two split components that share a linked pair of virtual edges, and both components have type S or both have type P, merge them into a single larger component of the same type.
To find the split components, use
depth-first search
Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible alo ...
to find a structure that they call a palm tree; this is a
depth-first search tree with its edges
oriented
In mathematics, orientability is a property of some topological spaces such as real vector spaces, Euclidean spaces, surfaces, and more generally manifolds that allows a consistent definition of "clockwise" and "counterclockwise". A space is ...
away from the root of the tree, for the edges belonging to the tree, and towards the root for all other edges. They then find a special
preorder
In mathematics, especially in order theory, a preorder or quasiorder is a binary relation that is reflexive and transitive. Preorders are more general than equivalence relations and (non-strict) partial orders, both of which are special c ...
numbering of the nodes in the tree, and use certain patterns in this numbering to identify pairs of vertices that can separate the graph into smaller components. When a component is found in this way, a
stack data structure
In computer science, a stack is an abstract data type that serves as a collection of elements, with two main operations:
* Push, which adds an element to the collection, and
* Pop, which removes the most recently added element that was not y ...
is used to identify the edges that should be part of the new component.
Usage
Finding 2-vertex cuts
With the SPQR tree of a graph ''G'' (without Q nodes) it is straightforward to find every pair of vertices ''u'' and ''v'' in ''G'' such that removing ''u'' and ''v'' from ''G'' leaves a disconnected graph, and the connected components of the remaining graphs:
* The two vertices ''u'' and ''v'' may be the two endpoints of a virtual edge in the graph associated with an R node, in which case the two components are represented by the two subtrees of the SPQR tree formed by removing the corresponding SPQR tree edge.
* The two vertices ''u'' and ''v'' may be the two vertices in the graph associated with a P node that has two or more virtual edges. In this case the components formed by the removal of ''u'' and ''v'' are represented by subtrees of the SPQR tree, one for each virtual edge in the node.
* The two vertices ''u'' and ''v'' may be two vertices in the graph associated with an S node such that either ''u'' and ''v'' are not adjacent, or the edge ''uv'' is virtual. If the edge is virtual, then the pair (''u'',''v'') also belongs to a node of type P and R and the components are as described above. If the two vertices are not adjacent then the two components are represented by two paths of the cycle graph associated with the S node and with the SPQR tree nodes attached to those two paths.
Representing all embeddings of planar graphs
If a planar graph is 3-connected, it has a unique planar embedding up to the choice of which face is the outer face and of
orientation
Orientation may refer to:
Positioning in physical space
* Map orientation, the relationship between directions on a map and compass directions
* Orientation (housing), the position of a building with respect to the sun, a concept in building desi ...
of the embedding: the faces of the embedding are exactly the nonseparating cycles of the graph. However, for a planar graph (with labeled vertices and edges) that is 2-connected but not 3-connected, there may be greater freedom in finding a planar embedding. Specifically, whenever two nodes in the SPQR tree of the graph are connected by a pair of virtual edges, it is possible to flip the orientation of one of the nodes (replacing it by its mirror image) relative to the other one. Additionally, in a P node of the SPQR tree, the different parts of the graph connected to virtual edges of the P node may be arbitrarily
permuted. All planar representations may be described in this way.
See also
*
Block-cut tree, a similar tree structure for the 2-vertex-connected components
*
Gomory–Hu tree
In combinatorial optimization, the Gomory–Hu tree of an undirected graph with capacities is a weighted tree that represents the minimum ''s''-''t'' cuts for all ''s''-''t'' pairs in the graph. The Gomory–Hu tree can be constructed in maximum ...
, a different tree structure that characterizes the edge connectivity of a graph
*
Tree decomposition
In graph theory, a tree decomposition is a mapping of a graph into a tree that can be used to define the treewidth of the graph and speed up solving certain computational problems on the graph.
Tree decompositions are also called junction trees ...
, a generalization (no longer unique) to larger cuts
Notes
References
*.
*.
*.
*.
*.
*.
*.
External links
SPQR tree implementationin the Open Graph Drawing Framework.
The tree of the triconnected components Java implementationin the jBPT library (see TCTree class).
{{DEFAULTSORT:Spqr Tree
Trees (data structures)
Graph connectivity
Graph data structures