Connectivity Oracles for Planar Graphs

# Connectivity Oracles for Planar Graphs

Glencora Borradaile111School of Electrical Engineering and Computer Science, Oregon State University, glencora@eecs.orst.edu. Supported by NSF CCF-0963921.    Seth Pettie222Supported by NSF CAREER grant no. CCF-0746673 and a grant from the US-Israel Binational Science Foundation.    Christian Wulff-Nilsen 333Department of Mathematics and Computer Science, University of Southern Denmark, koolooz@diku.dk, http://imada.sdu.dk/cwn/. This research was partially supported by NSERC and MRI.
###### Abstract

We consider dynamic subgraph connectivity problems for planar undirected graphs. In this model there is a fixed underlying planar graph, where each edge and vertex is either “off” (failed) or “on” (recovered). We wish to answer connectivity queries with respect to the “on” subgraph. The model has two natural variants, one in which there are edge/vertex failures that precede all connectivity queries, and one in which failures/recoveries and queries are intermixed.

We present a -failure connectivity oracle for planar graphs that processes any edge/vertex failures in time so that connectivity queries can be answered in time. (Here and are the time for integer sorting and integer predecessor search over a subset of of size .) Our algorithm has two discrete parts. The first is an algorithm tailored to triconnected planar graphs. It makes use of Barnette’s theorem, which states that every triconnected planar graph contains a degree-3 spanning tree. The second part is a generic reduction from general (planar) graphs to triconnected (planar) graphs. Our algorithm is, moreover, provably optimal. An implication of Pǎtraşcu and Thorup’s lower bound on predecessor search is that no -failure connectivity oracle (even on trees) can beat query time.

We extend our algorithms to the subgraph connectivity model where edge/vertex failures (but no recoveries) are intermixed with connectivity queries. In triconnected planar graphs each failure and query is handled in time (amortized), whereas in general planar graphs both bounds become .

## 1 Introduction

Algorithms for dynamic graphs have traditionally assumed that the graph evolves according to a completely arbitrary sequence of insertions and deletions of graph elements. This model makes minimal assumptions but often sacrifices efficiency for generality. For example, real world networks (router networks, road networks, etc.) do change slowly over time. However, the real dynamism of the networks comes from the frequent failure of edges/nodes and their subsequent recovery. In this paper we study connectivity problems in the dynamic subgraph model, which attempts to accurately model this type of dynamism. It is assumed that there is some fixed underlying graph whose nodes and edges can be off (failed) or on; queries (connectivity queries, in our case) then answer questions about the subgraph turned on. The power of this model (compared to the fully dynamic graph model) stems from the ability to preprocess the underlying graph in advance.

There are two natural variants of the dynamic subgraph model. In the -failure version failures and recoveries occur in lockstep: a set of edges/nodes fail together. Our goal is to process , ideally in time, in order to answer connectivity queries in . Here may or may not be a parameter of the algorithm. In the fully dynamic model, node/edge failures and recoveries are presented one at a time and intermixed with connectivity queries, whereas in the decremental model the updates are restricted to failures.

#### Results.

We give new algorithms for subgraph connectivity (aka connectivity oracles) on undirected planar graphs in the -failure model and the decremental model, all of which require linear preprocessing time. When failures are restricted to edges, we give an especially simple connectivity oracle that processes edge failures (for any ) in time and subsequently answers queries in time. Here and refer to the time for sorting integers in the universe and for the time for predecessor search, given preprocessing time. (It is known that deterministically, randomized [23, 24], and randomized if  [4]. For predecessor search the bound is deterministically [20, 5] and randomized [32, 34].)

The problem becomes more complicated when vertices fail since we cannot, in general, spend time proportional to their degrees. Our second algorithm is a -failure connectivity oracle for edge and vertex failures with the same parameters (linear preprocessing, to process failures, time per query). It consists of two parts: a solution for triconnected graphs and a generic reduction from -failure oracles in general graphs to -failure oracles in triconnected graphs. Triconnectivity plays an important role in the algorithm as it allows us to apply Barnette’s theorem [6], which states that every triconnected planar graph contains a degree-3 spanning tree. It is known [30] that predecessor search is reducible to the -edge/node failure connectivity problem on trees (and hence planar graphs). Our query time is therefore provably optimal. In particular, Pǎtraşcu and Thorup’s lower bound [29] implies that query time cannot be beaten in general, even given time to preprocess the edge/node failures.

Our third algorithm is in the decremental model. In triconnected planar graphs we can support vertex failures in amortized time and connectivity queries in time, whereas in general planar graphs both bounds become .444These bounds are amortized over the actual number of failures, i.e., in triconnected graphs processing failures takes time total. The logarithmic slowdown comes from a new reduction from (planar) dynamic subgraph connectivity to the same problem in triconnected graphs.

#### Prior Work on Dynamic Connectivity.

Before surveying dynamic subgraph connectivity it is instructive to see what type of “off the shelf” solutions are available using traditional dynamic graph algorithms. The best known dynamic connectivity algorithms for general undirected graphs require worst case time per edge update [19, 17] or time amortized [26]. Vertex updates are simulated with edge updates. In dynamic planar graphs the best connectivity algorithms take time per edge update [18].

#### Prior Work on Subgraph Connectivity.

The dynamic subgraph model was proposed explicitly by Frigioni and Italiano [21], who proved that in planar graphs, node failures and recoveries could be supported in amortized time per operation and connectivity queries in worst case time. An earlier algorithm of Eppstein et al. [18] implies that edge failures, edge recoveries, and connectivity queries in planar graphs require time. In general graphs, Chan, Pǎtraşcu, and Roditty [11] (improving [10]) showed that node updates could be supported in amortized time , where is the number of edges, and connectivity queries in . Chan et al. [1, 10, 11] gave numerous applications of subgraph connectivity to geometric connectivity problems. The first algorithm with worst-case guarantees was given by Duan [13], who showed that node updates and queries require only and time, respectively.

In the -edge failure model Pǎtraşcu and Thorup [30] gave a connectivity oracle for general graphs that processes failures in time and answers queries in time. However, their structure requires exponential preprocessing time; a variant constructible in polynomial time has a slower update time: . Duan and Pettie [15] gave a connectivity oracle in the -node failure model occupying space that processes failures in time and answers queries in time, where depends on . They also showed that a -edge failure oracle could be constructed in time with update time and query time.

The distance sensitivity oracles avoiding 1 node failure [12, 9] or 2 node failures [14] also, as a special case, answer 1- and 2-failure connectivity queries on directed graphs in and time, respectively. These data structures occupy space.

#### Overview

Section 2 reviews notation and terminology. In Section 3 we describe our planar -edge failure connectivity oracle. In Section 4 we give a -vertex failure oracle for triconnected planar graphs and in Section 5 we extend it to a decremental subgraph connectivity oracle for triconnected graphs. Finally, in Section 6 we give reductions from general graphs to triconnected graphs, which do not assume planarity.

## 2 Definitions, Notation, and Basic Results

We assume that all graphs considered are undirected. A planar graph is a graph that can be drawn in the plane such that no two edges cross. We refer to such a drawing as a plane graph. A plane graph partitions the plane into maximal open connected sets and we refer to the closure of these sets as the faces of . If is connected, we define a plane graph, called the dual graph of , as follows. Associated with each face of is a vertex in which we identify with and which we draw inside . For each edge in , there is an edge in , where and are the faces in incident to . We draw such that it crosses exactly once and crosses no other edge in or in . We identify with . It can be shown that is also connected and that . In particular, each face in corresponds to a vertex in . We refer to as the primal graph.

For vertices and in a rooted tree , we let denote the lowest common ancestor of and in . Consider a spanning tree in primal graph . It is well-known that the edges not present in form a spanning tree of . We call the dual tree of . The following lemma is a well-known result [33].

###### Lemma 1.

For an edge in primal tree , let and be the faces to either side of in . Then the edges of that connect the two subtrees of are exactly those on the simple path in from to .

A co-path is a sequence of faces that is a sequence of vertices in the dual that form a path. A co-path avoids a set of edges if every consecutive pair of faces in the sequence shares an edge not in .

## 3 Edge Failures

In this section, we develop a data structure that, given a planar undirected graph , an integer , and a dynamic subset of at most failed edges, supports the following operations:

1. update: set to be the set of failed edges;

2. connected?: are vertices and connected in ?

We may assume that is plane and connected. We will examine this problem in the dual by way of the following lemmas:

###### Lemma 2.

Two vertices and are connected in iff there is a -to- co-path in avoiding .

###### Proof.

If and are connected in , then there is a -to- path in not using any edges in . This path, viewed as a sequence of vertices in is a sequence of faces, or co-path, in . Since consecutive vertices in are adjacent by way of edges not in , consecutive faces in the identified co-path share an edge not in : this -to- co-path avoids .

Conversely, let be a -to- co-path avoiding . is a sequence of faces in , and so is a sequence of vertices in . Consecutive faces on in share an edge avoiding and so are adjacent by way of edges not in : is a path in not using any edges in . ∎

Consider the subgraph of consisting of the failed edges, . Let inherit the embedding of . We refer to the faces of as superfaces. Each superface corresponds to the union of faces of .

###### Lemma 3.

Let and be faces of . There is an -to- co-path in avoiding iff and are contained in the same superface of .

###### Proof.

Suppose and are contained in different superfaces; let be the set of edges that bound the superface containing . Any -to- co-path requires a face on either side of and so cannot avoid , which is a subset of .

Suppose otherwise; let be the set of faces of that form the superface containing and . Since is a face of , there is a curve contained entirely in that starts inside and ends inside . Consider the sequence of faces in that this path visits; this is an -avoiding -to- co-path as consecutive faces must share an edge that crosses and this edge cannot be in . ∎

We restate the operations in light of the corollary:

###### Corollary 1.

Two vertices and are connected in iff and are contained in the same superface of .

1. update: set to be the set of failed edges;

2. connected?: are and contained in the same superface of ?

### 3.1 The data structure

Fix a rooted spanning tree of the primal graph . We use to determine the superfaces of containing the faces corresponding to the query vertices and . To do so, we require constant-time lca query support for  [25, 2, 8].

#### update(F):

The edges are listed in no particular order. We start by building the planar embedding of the subgraph induced by that is inherited from . Let be the endpoints of (in the dual sense). For each vertex identify the edges of incident to and their cyclic ordering555The cyclic ordering of edges incident to each vertex is sufficient to define the embedding. [16] in . We can compute these orderings in time.

The boundaries of the superfaces given by can be traversed in time given this combinatorial embedding. The set is the set of faces of that are along the boundaries of superfaces of . Label a dual face/primal vertex in with the superface that contains it; mark the vertices of the static tree with these superface labels.

#### connected?(u,v):

To answer a query connected?, suppose we have identified the first and last marked vertices (if any) on the -to- path in ; call them and .666This is a slightly more general problem than the marked ancestor problem considered by Alstrup, Husfeldt, and Rauhe [3]. By Lemmas 2 and 3, and are connected in iff and do not exist, or and are labelled with the same superface. Therefore, we need only identify and , if they exist. Lemma 4 shows that finding and is reducible to one least common ancestor query and predecessor queries.

###### Lemma 4.

Let be a tree of size and be a set of marked vertices, with . Then after preprocessing (independent of ), an -size data structure can be constructed in time that answers the following query in time: Given , what are the first and last -vertices on the - path?

###### Proof.

Recall that is rooted. Let . The first marked vertex on the -to- path is either the first marked vertex on the -to- path or the last marked vertex on the -to- path. Thus, we can assume without loss of generality that is an ancestor of . Fix an arbitrary DFS of and let (resp. ) be the time when is pushed onto (resp. popped off) the stack during DFS. Given , we first sort the and indices of its elements, in time, which allows us to label each with the nearest strictly ancestral -vertex . Here it is convenient to assume that the root is marked (honorarily, if not in ) so is defined everywhere except the root. We build a global predecessor structure on the set and local predecessor structures on the sets , where and is the set of “immediate” descendants in connected by a path of non- vertices. To answer a query (where is ancestral to ) we first find the closest marked ancestors as follows. Let be the predecessor of in . If for some then is an immediate descendant of and . If then let . See Figure 1(a). It follows that is an ancestor of and that there are no other -vertices on the path from to . If is ancestral to then there are no marked nodes on the - path, so assume this is not the case. In order to find the last marked vertex on the path from to we search for the predecessor of in , say . Since there is some marked vertex on the path from to it follows that is a descendant of , which is a descendant of and that there are no other marked vertices on the path from to . See Figure 1(b). ∎

We now have the following:

###### Theorem 1.

There is a data structure for planar undirected -vertex graphs and any that after preprocessing time supports update in time, where , , and supports connected? in time.

## 4 Vertex and Edge Failures

We now turn our attention to the scenario where both edges and vertices can fail. The additional challenge arises from high degree vertices that, when failed, can greatly reduce the connectivity of the graph. Nevertheless we will show how to maintain dynamic connectivity in time proportional to the number of failed vertices, rather than their degrees. Formally, we develop a data structure that, given a planar, undirected graph , an integer , and a dynamic subset of at most failed edges and vertices, supports the following operations:

1. update: set to be the failed set of vertices and edges;

2. connected?: are vertices and connected in ?

As before we may assume that is plane and connected.

### 4.1 Vertex failures for triconnected planar graphs

In this subsection we shall assume that is triconnected. This allows us to apply Barnette’s theorem, which states that every triconnected planar graph has a spanning tree of degree at most three [6]. Furthermore, such a degree-three tree, , can be found in linear time [31]. In Section 6 we show that this assumption is basically without loss of generality: we can reduce the problem on general graphs to triconnected graphs with an additive slowdown in the query and update algorithms.

Assume for simplicity that only vertices fail. Section 4.3 describes modifications needed when there is a mix of vertex and edge failures. Let be the clockwise cycle that bounds the infinite and only face of . is an embedding-respecting Euler tour of that visits each edge twice and each vertex at most three times. For a non-empty subset of , partition into maximal subpaths whose internal nodes are not in . Denote this set of paths by . Note that and therefore that a connected component of is made up of possibly many paths in . Assign the connected components of distinct colors and label each path in with the color of its component.

Let and be the edges before and after a particular copy of vertex in the order given by . Let be the face of to the left of . Root the dual spanning tree at the infinite face of and let . If is not the root of , let be the parent edge of in . Let be the set of edges (if well defined) with neither endpoint in for all failed vertices (according to their multiplicity in ). Note that . By duality, we consider as a subset of primal edges. Considered as an edge of the primal graph, forms a cycle with that is on; that is, witnesses an alternate connection should fail.

We define an auxiliary graph that will succinctly represent the connectivity of . The nodes of are the paths in . Two path-nodes are adjacent in iff

• and have the same color and are consecutive paths in among paths of the same color, or

• there is an edge in between the interior of and the interior of .

There are at most edges of the first type and edges of the second type. Since and , .

###### Lemma 5.

Paths in are connected in iff they are connected in .

###### Proof.

Consider distinct paths and in . It is clear from the definition of and that if there is an edge in then the interior of and the interior of are connected in . This implies the “if” part.

Since path-nodes of a given color class are connected by a cycle in given by the paths order along . If two paths are of the same color, their path-nodes will be connected in . So, for the “only if” part, it suffices to show that if and are different colors but (by transitivity of connectivity) there is a single edge between the interior of and the interior of , then they are connected in .

So let be such an edge where . Let and be the faces incident to in such that is the child of in . Let be the bounded face of (which contains and encloses ). Let be the failed vertex that is an endpoint of on the bounded face of .

We continue by induction on the number of faces of contained in . In the base case and . Here , so and is an edge of . Now assume and that the inductive hypothesis holds for smaller values.

If has a failed vertex on its boundary, then we argue (and so is an edge of ). Consider the copy of in the traversal of that has to the left. Let and be the faces to the left of the edges before and after this copy of in . Since , is an ancestral edge of and . Since all contain as a boundary vertex, .

Suppose that has no failed vertices on the boundary. For each edge on the boundary of , if then belongs to a path of . Otherwise, the bounded face of is contained in and does not contain so it contains fewer than faces of . Then the paths of containing the endpoints of in their interior are connected in if they have distinct colors (by the inductive argument) or if they have the same color (by the start of this proof). Since this holds for every edge of , and are connected in , as desired. ∎

### 4.2 The data structure

In a linear-time preprocessing step, we compute , , and and initialize an data structure.

#### update(F):

We build for the input set of failed vertices . Let be the sum of the degrees in of the vertices in ; note, . Let be the multiset of failed vertices according to their multiplicity along , i.e., their degree in . Again, . Sort the vertices of according to their order along . This provides an implicit representation of . Label these paths according to their ordinal in ; that is, path is the path starting with the vertex in sorted . This takes time .

Greedily assign colors to the paths, considering the paths in order. In each iteration we assign colors to all the paths in a given color class. Upon considering path , if has not yet been colored, assign it a new color. Check the second last endpoint of and find the edge that precedes that vertex in after . Let be the path that starts with edge (which can be found by ’s starting point in ). Color with same color as . Repeat until returning to . This takes time .

Build the set of edges. For each edge in , identify the paths in that contain its endpoints. We do this in bulk. Sort the set of endpoints of along with , that is, , according to their order along . Traverse this order, assigning each endpoint in the path corresponding to the last failed vertex visited. This takes time .

From (with endpoints labelled with the appropriate path in ) and the colors of , build . Compute the connected components of and label the path-nodes of with the name of the connected component it belongs to. This takes time .

The total time for update is bounded by .

#### connected?(u,v):

We may assume . In time identify any path containing in the interior and any path containing in the interior. By Lemma 5, and are connected in iff and are in the same connected component of . The latter condition is checked in constant time given the labels of the connected components.

### 4.3 Dealing with vertex and edge failures simultaneously

We now extend our results above for triconnected planar graphs to handle both vertex and edge failures. As before, we precompute , , , and a structure for answering lca queries. An update-operation now gets as input a set of size at most . For the failures in , we partition the tree into set of paths as before. Edges of that belong to can be treated in a way similar to vertex failures (this can be seen easily by, say, introducing a degree two-vertex to the interior of each such edge and regarding it as a failed vertex).

What remains is to deal with failed edges that go between paths from . The only modification we need to make to update is that when we find the -vertex in of two faces of incident to a failed vertex or edge of , we need to check if the edge from to its parent in has failed. If so, we need to walk up the path from to the root of until we find a vertex whose parent edge has not failed or . Our algorithm then has the same behaviour as the update operation of the previous subsection would have when applied to with input .

The only issue is the additional running time needed to traverse paths to in . We deal with this as follows. When a path has been traversed, we store pointers from all visited vertices to the last vertex on the path (i.e., the vertex closest to the root of ). If in another traversal we encounter a vertex with a pointer, we use this pointer to jump directly to that last vertex. The total number of edges traversed in is then bounded by the number of failed edges which is at most . Hence, update still runs in time. The connected?-operation can be implemented as before.

By Theorem 4 the algorithm above extends to general planar graphs with no asymptotic slowdown.

###### Theorem 2.

There is a data structure for any planar undirected -vertex graph that, after preprocessing time, supports update in time, where , , and supports connected? in time.

## 5 Decremental Subgraph Connectivity

In this section, we consider the model in which updates and queries are intermixed. We only allow failures and not recoveries but no longer assume an upper bound on , that is, is a growing set.

As in Section 4, we first assume that is triconnected and that only vertices can fail. Define , , , , and as before and build an data structure for . Initially and are empty. Redefine to be , that is, we no longer contract paths in . For each vertex we maintain a list of the -edges incident to . Represent as a subset of marked edges of .

When a vertex fails, unmark in since should only contain edges not incident to failed vertices. For each of the at-most-three occurrences of along , find the corresponding -edge (if it exists); if has no endpoint in , mark as a member of and add to the lists of its endpoints.

It follows easily from the definition of and of that both and are updated correctly after each failure. Lemma 5 (that two vertices are connected in iff they are connected in ) holds with these definitions; the only difference is the interior of the paths from are explicitly represented with the edges from . Note that showing the requisite connectivity for Lemma 5 does not depend on -edges that have a failed endpoint. Removing (unmarking) the edges as members of when fails is equivalent to not including them in as used in the proof of Lemma 5.

We maintain with an oracle which allows us to delete an edge and an isolated vertex in time [18] since a vertex failure results in at most three edges of being deleted from . Furthermore, at most three edges are added to and each of these edges is added only to the two lists associated with its endpoints. Hence if is the final set of deleted vertices, then a total of edges are added or removed from and there are at most updates to and to the lists . It follows that each deletion takes amortized time. A connectivity query can be answered in worst-case time with the oracle associated with .

So far we considered only vertex deletions. Edge deletions can be handled in the same way as in Section 4.3. Using the reduction from general planar graphs to triconnected planar graphs in Theorem 5 we have the following.

###### Theorem 3.

There is a data structure for decremental subgraph connectivity in triconnected planar graphs that, after preprocessing time, allows an intermixed sequence of vertex/edge failures and connectivity queries in amortized time per failure (i.e., failures in time total) and worst-case time per query. In general planar graphs there is a data structure requiring amortized time per failure and worst-case time per query.

## 6 Reductions to Triconnected Graphs

In this section we give the reductions from general (planar) graphs to triconnected (planar) graphs that were used in Sections 4 and 5. Although the algorithm from Section 5 handles only failures, the reduction allows both failures and recoveries.

###### Theorem 4.

(The -Failure Model) Suppose there is a connectivity oracle for any triconnected (planar) graph with the following parameters. The preprocessing time is , the time to update the structure after edge or vertex failures is , and the time for a connectivity query is . Then there is a connectivity oracle for any (planar) graph with parameters , , and .

###### Theorem 5.

(The Fully Dynamic Subgraph Model) Suppose there is a connectivity oracle for any triconnected (planar) graph with the following parameters. The preprocessing time is , the time to process a vertex failure or recovery is , the time to process an edge failure or recovery , and the time for a connectivity query is . Then there is a connectivity oracle for any (planar) graph with parameters , , , and .

The proof of Theorem 4 requires two steps: a reduction from connected to biconnected graphs and a reduction from biconnected to triconnected graphs. These are given in Sections 6.1 and 6.2. Theorem 5 is proved in Section 6.3. Throughout this section we assume for simplicity that consists solely of vertices.

### 6.1 Reduction to Biconnected Graphs in the d-Failure Model

Let and be the preprocessing, update, and query times for an oracle for biconnected graphs. Let be the set of articulation points (vertices whose removal disconnects ) and be the set of biconnected components in . The component tree on the vertex set consists of edges connecting articulation points to their incident biconnected components.777The subscript 2 refers to biconnectivity. Root at an arbitrary -node and let be the parent of in . The function maps graph vertices into their corresponding nodes, that is, if , ; otherwise, where is the biconnected component containing .

For any let be the most ancestral -node reachable from in , or if there is no such -node, that is, if is disconnected from . The goal of the preprocessing algorithm is to build a structure that lets us evaluate .

#### Processing Vertex Failures

First, mark red every articulation point in and blue every component for which . This takes time. For a -node , let be the most distant -node ancestor of reachable by a path of uncolored vertices. By Lemma 4 we can evaluate in time with preprocessing. (Note that does not exist if is red or if and is red.)

In time preprocess each blue component to support connectivity queries in . If is uncolored, let be the parent of in . (It may be that .) Determine if and are still connected in via one connectivity query and, if not, mark red the edge . A red edge indicates that is disconnected from but possibly still connected to other vertices in . It takes time to find all such red edges. For let be the most distant -node ancestor of reachable by a path of uncolored vertices and edges. Using a preorder traversal of the blue nodes, compute for all blue in time.

#### Connectivity Queries

To evaluate and we require two intra-component connectivity queries and two queries. To determine if and are connected we may require an additional intra-component connectivity query, for a total time of .

Let and be the corresponding nodes in . Let and, if exists, let be the parent of . If does not exist let and let be ’s component. If exists and is connected to let , otherwise let ; in both cases let be the parent of , if is not already the root. It follows that is a graph node, not a component, that is connected to in , and that is disconnected from . The nodes and are defined similarly. It follows that we must return connected if , disconnected if , and connected if and are connected in . In total there are up to three intra-component connectivity queries, on the pairs and . There are two necessary queries to and . The nodes and were computed when processing .

### 6.2 Reduction to Triconnected Graphs in the d-Failure Model

An tree represents how a biconnected graph is assembled form its triconnected components through merging operations. All separating pairs of are given implicitly by . Let and be two edge-labeled multigraphs, where and where appears in both and with the same label. Then merging and results in a new graph . That is, does not appear in the merged graph but and may still be adjacent in if there were multiple edges between and in either or .

Each node is associated with a triple , where is the model graph, one edge is distinguished as the polar edge whose endpoints are poles. Let be the parent of in and the subtree rooted at . The graphs and have exactly two vertices in common, namely the endpoints of , and each contains identically labeled copies of . Moreover, for any two -nodes on opposite sides of the edge , their model trees do not intersect, except possibly at the poles of . The graph is formed by merging all model trees in . That is, has children where and contains the polar edge . Obtain by merging with along the polar edges . (Observe that the polar edge remains in .) Let be without its polar edge .

The tree is conceptually constructed in a top-down fashion as follows. (Linear time triconnectivity algorithms [27, 28, 22] can be used to construct .) The root is associated with and an arbitrary polar edge . In general, we are given a -node and pair . We must select a model multigraph and then recursively construct the subtree . The reader may want to refer to an illustration of a graph and its -tree in Figure 3.

#### Parallel Case (P-node).

The endpoints of split into components where . Let be augmented with a freshly labeled polar edge and let consist of parallel edges . Clearly merging with yields . For each nontrivial (nontrivial means having more than one edge), create a new child of and recursively compute its subtree in .888In previous work on trees [7] trivial graphs are actually assigned to children of . They are called -nodes.

#### Series Case (S-node).

Let and let be the articulation points of . If there are any such points () let be the partition of into edge-disjoint subgraphs such that and meet at . Let be the cycle and let be augmented with a polar edge (where ), whose label matches the corresponding edge in . For each non-trivial form a new child of and recursively compute its subtree in .

#### Rigid Case (R-node).

The previous two cases do not apply. A separating pair of splits it into some number of components with . Let and be the union of . Call maximal if there is no separating pair for which is strictly contained in . Let be the set of maximal separating pairs with respect to . We give children where is given the graph and polar edge . The model graph is induced by , that is, it is obtained from be replacing with the ’s polar edge , for all . The maximality of the separating pairs ensures that is triconnected, also called rigid.

###### Observation 1.

The edges in a model graph that do not appear in are artificial and represent paths in . Our goal is to reduce a connectivity query in to a constant number of connectivity queries in model graphs, so it is important that we identify the set of invalidated artificial edges.

#### Preprocessing Vertex Failures

Let , where , be the most ancestral -node for which and let . (Note that can appear in an unbounded number of model trees as a pole.) We begin by coloring blue those -nodes for which the endpoints of may be disconnected in . Specifically, repeatedly color blue any satisfying one of the following criteria:

1. for some .

2. is an -node with at least one blue child. ( is a path, so the removal of one vertex or edge disconnects ’s poles.)

3. is either an - or -node with at least two blue children. (There are at least two internally vertex-disjoint paths between the endpoints of in , so the removal of just one vertex or edge cannot disconnect ’s poles.)

###### Lemma 6.

There are fewer than blue nodes. They can be found in time.

###### Proof.

There are clearly at most blue nodes due to criterion (1) and at most due to criterion (3). Since, by Observation 1, there are no adjacent -nodes, the number due to criterion (2) is no more than the number due to criteria (1) and (3). They can be found in time as follows. For each color blue and continue to color any immediate ancestors blue if they satisfy criteria (2) or (3). The first ancestor not colored blue is noted as having one blue child. The time per -node is plus the number of formerly uncolored ancestors colored blue. ∎

Next we color purple all blue nodes for which the poles of are disconnected in (that is, ignoring parts of the graph outside ’s subtree), as follows. Traverse the blue nodes in in postorder. If either of or is in then they are trivially disconnected, so color purple. If is a -node then and are still connected if they are connected in any child of , so color purple if all its children are purple. If is an -node then and are disconnected if the poles of any child of are disconnected, so color purple if any child is purple. Finally, if is an -node, construct a connectivity oracle for avoiding vertex failures and edge failures . (The edge failures reflect the fact that the polar edges of purple children are definitely invalidated by the failures and it is not yet known if is invalidated.) Perform one query on to determine if are disconnected in and, if so, color purple.

We also construct connectivity oracles for each colored - and -node in . This is trivial if is a -node. ( contains two vertices, which are either connected or not.) If is an -node then is a cycle and a connectivity query can be answered with predecessor search, in time. The time to construct oracles for all colored nodes is .

###### Lemma 7.

In the construction of connectivity oracles , there are vertex and edge failures in total.

###### Proof.

Each colored node can contribute one edge failure to , namely the polar edge . Note that can include at most two additional vertices than , namely the poles of . Thus, the total number of failures is linear in and the number of colored nodes, which are fewer than . ∎

Let be the farthest ancestral pole reachable from , or if there is no such pole. Specifically, let be the farthest ancestor of such that is connected to either pole in in . If there is no such ( is disconnected from ) then and if is connected to both poles then can be either one. Our goal is to preprocess so that we can quickly evaluate .

Let be either pole in connected to in , or undefined if there is no such pole. Let be the farthest ancestral pole reachable from via uncolored nodes, defined precisely as follows. If and is colored then is undefined. If is uncolored and is disconnected from both of ’s poles (this can only happen if they are in the failure set) then is undefined. Otherwise let be the farthest ancestor of such that the