Lably
Skip to content

Courcelle's theorem

On linear-time algorithms for graph logic

  • 9 min read
  • 5 chapters

Related on Lably

Through Algorithm, Graph (discrete mathematics) and Cardinality

Formulations

Vertex sets

In one variation of monadic second-order graph logic known as MSO1, the graph is described by a set of vertices and a binary adjacency relation adj⁡(.,.), and the restriction to monadic logic means that the graph property in question may be defined in terms of sets of vertices of the given graph, but not in terms of sets of edges, or sets of tuples of vertices.

As an example, the property of a graph being colorable with three colors (represented by three sets of vertices R, G, and B) may be defined by the monadic second-order formula ∃R∃G∃B(∀v(v∈R∨v∈G∨v∈B)∧∀u∀v((u∈R∧v∈R)→¬adj⁡(u,v))∧∀u∀v((u∈G∧v∈G)→¬adj⁡(u,v))∧∀u∀v((u∈B∧v∈B)→¬adj⁡(u,v))) with the naming convention that uppercase variables denote sets of vertices and lowercase variables denote individual vertices (so that an explicit declaration of which is which can be omitted from the formula). The first part of this formula ensures that the three color classes cover all the vertices of the graph, and the rest ensures that they each form an independent set. (It would also be possible to add clauses to the formula to ensure that the three color classes are disjoint, but this makes no difference to the result.) Thus, by Courcelle's theorem, 3-colorability of graphs of bounded treewidth may be tested in linear time.

For this variation of graph logic, Courcelle's theorem can be extended from treewidth to clique-width: for every fixed MSO1 property Π, and every fixed bound b on the clique-width of a graph, there is a linear-time algorithm for testing whether a graph of clique-width at most b has property Π. The original formulation of this result required the input graph to be given together with a construction proving that it has bounded clique-width, but later approximation algorithms for clique-width removed this requirement.

Edge sets

Courcelle's theorem may also be used with a stronger variation of monadic second-order logic known as MSO2. In this formulation, a graph is represented by a set V of vertices, a set E of edges, and an incidence relation between vertices and edges. This variation allows quantification over sets of vertices or edges, but not over more complex relations on tuples of vertices or edges.

For instance, the property of having a Hamiltonian cycle may be expressed in MSO2 by describing the cycle as a set of edges that includes exactly two edges incident to each vertex, such that every nonempty proper subset of vertices has an edge in the putative cycle with exactly one endpoint in the subset. However, Hamiltonicity cannot be expressed in MSO1.

Labeled graphs

It is possible to apply the same results to graphs in which the vertices or edges have labels from a fixed finite set, either by augmenting the graph logic to incorporate predicates describing the labels, or by representing the labels by unquantified vertex set or edge set variables.

Modular congruences

Another direction for extending Courcelle's theorem concerns logical formulas that include predicates for counting the size of the test. In this context, it is not possible to perform arbitrary arithmetic operations on set sizes, nor even to test whether two sets have the same size. However, MSO1 and MSO2 can be extended to logics called CMSO1 and CMSO2, that include for every two constants q and r a predicate cardq,r⁡(S) which tests whether the cardinality of set S is congruent to r modulo q. Courcelle's theorem can be extended to these logics.

Decision versus optimization

As stated above, Courcelle's theorem applies primarily to decision problems: does a graph have a property or not. However, the same methods also allow the solution to optimization problems in which the vertices or edges of a graph have integer weights, and one seeks the minimum or maximum weight vertex set that satisfies a given property, expressed in second-order logic. These optimization problems can be solved in linear time on graphs of bounded clique-width.

Space complexity

Rather than bounding the time complexity of an algorithm that recognizes an MSO property on bounded-treewidth graphs, it is also possible to analyze the space complexity of such an algorithm; that is, the amount of memory needed above and beyond the size of the input itself (which is assumed to be represented in a read-only way so that its space requirements cannot be put to other purposes). In particular, it is possible to recognize the graphs of bounded treewidth, and any MSO property on these graphs, by a deterministic Turing machine that uses only logarithmic space.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Topics in mathematics