Properties of graphs specified by a regular language
Acta Informatica (2022) 59:357–385
https://doi.org/10.1007/s00236-022-00427-z
ORIGINAL ARTICLE
Properties of graphs specified by a regular language
Volker Diekert1
· Henning Fernau2
· Petra Wolf2
Received: 12 October 2021 / Accepted: 17 June 2022 / Published online: 12 August 2022
© The Author(s) 2022
Abstract
Traditionally, graph algorithms get a single graph as input, and then they should decide if this
graph satisfies a certain property Φ. What happens if this question is modified in a way that
we get a possibly infinite family of graphs as an input, and the question is if there is a graph
satisfying Φ in the family? We approach this question by using formal languages for specifying families of graphs, in particular by regular sets of words. We show that certain graph
properties can be decided by studying the syntactic monoid of the specification language L
if a certain torsion condition is satisfied. This condition holds trivially if L is regular. More
specifically, we use a natural binary encoding of finite graphs over a binary alphabet Σ, and
we define a regular set G ⊆ Σ ∗ such that every nonempty word w ∈ G defines a finite
and nonempty graph. Also, graph properties can then be syntactically defined as languages
over Σ. Then, we ask whether the automaton A specifies some graph satisfying a certain
property Φ. Our structural results show that we can answer this question for all “typical”
graph properties. In order to show our results, we split L into a finite union of subsets and
every subset of this union defines in a natural way a single finite graph F where some edges
and vertices are marked. The marked graph in turn defines an infinite graph F ∞ and therefore the family of finite subgraphs of F ∞ where F appears as an induced subgraph. This
yields a geometric description of all graphs specified by L based on splitting L into finitely
many pieces; then using the notion of graph retraction, we obtain an easily understandable
description of the graphs in each piece.
Research supported by DFG project FE 560/9-1.
Preamble: We dedicate the paper to Klaus–Jörn Lange on the occasion of his 70th birthday. The conference
abstract of the present paper appeared in [80]. Here, we give full proofs and we correct some mistakes.
B Volker Diekert
Henning Fernau
Petra Wolf
1
Formal Methods in Informatics, Universität Stuttgart, Stuttgart, Germany
2
FB 4 – Informatikwissenschaften, Universität Trier, Trier, Germany
123
358
V. Diekert et al.
1 Introduction
The paper is about families of finite graphs specified by regular languages, and their properties.
When dealing with algorithms, a graph is often specified by its adjacency matrix or by its
induced edge-list together with the number of isolated vertices, if there are any. In either
representation, a graph comes with a linear order on the vertices and the edges are directed.
Moreover, an adjacency matrix ignores multiple edges, but self-loops may occur. We follow
these conventions in our paper. We encode1 a finite graph G = (V , E) as a word over the
binary alphabet Σ = {a, b} as follows: The ith vertex u i of a graph is encoded by abi a and the
+
edge (u i , u j ) is encoded by abi aaab j a. Thus, every word w in G = ab+ a ∪ ab+ aaab+ a
represents in a natural way a unique graph ρ(w), because ab+ a ∪ ab+ aaab+ a is a regular
code. Namely, ρ(w) is the graph consisting of all vertices and edges whose encodings appear
as a factor in w ∈ G. Notice that it does not matter if a factor appears once or many times.
Given a finite graph G = (V , E) with any linear order on the vertices, we obtain a code
word γ (G) in G as follows. We write V as {1, . . . , |V |} using the bijection induced by the
linear order on V , and then we write the edges and the isolated vertices in the order which
yields the short-lex normal form of G in ρ −1 (G). This means that first, all edges are listed
and then, possible isolated vertices follow. We are interested in abstract graphs, only. Thus,
isomorphic graphs are treated as equal. Therefore, several γ (G)’s are possible, depending on
the linear orders on V , but even then, the short-lex normal form would give a unique syntactic
representation of G if necessary.
We cannot avoid that every nonempty graph G has infinitely many representations w ∈ G
such that ρ(w) = G. For example, the one-point graph ({}, ∅) is represented by all words
in the regular set L i = (abi a)+ as soon as i ≥ 1, i.e., for all w ∈ L i we have ρ(w) = G.
Given any L ⊆ G, it defines a set of graphs ρ(L). The main interest is when ρ(L) is
infinite but L ⊆ G is regular. The aim is to “understand” the infinite set of graphs in ρ(L).
It is far from obvious that this is possible. If L is finite, then ρ(L) is finite, too. But the
converse is false. As we will see, if L is regular, then we can decide finiteness of ρ(L); and if
ρ(L) is finite, then we can compute all its graphs. However, if ρ(L) is infinite, then a global
understanding of ρ(L) is, a priori, not easy.
1.1 A sketch of our approach and our results
Let us try to give a high-level explanation of the underlying geometric idea how to approach
the family of graphs ρ(L). Remotely, it is like understanding the geometry of a topological
manifold using the fact that it locally resembles an Euclidean space. For example, it is
possible to realize a torus (which is a compact two-dimensional surface) as a unit square
where opposite edges are identified. Every point has on open neighborhood which looks like
R2 and from that one easily derive that the so-called fundamental group (which is a global
property) is the group Z × Z. Therefore, we cannot transform a torus neither into a sphere
nor into a soup tureen with two or more handles.
In our case, we deal with purely combinatorial objects. Nevertheless, we wish to understand the set of graphs ρ(L) by constructing a finite subset of graphs together with an “open
neighborhood” around these graphs such that ρ(L) is covered by that construction. Thus, if
we want to check whether a certain property Φ is satisfied by some graph in ρ(L), then it is
enough that we are able to check that locally. The key idea is to cut first L into pieces using
the algebraic property that a regular language L has a finite syntactic monoid M L . Hence,
1 We briefly discuss our encoding of graphs as words (and some related work) in Sect. 1.2.
123
Properties of graphs specified by a regular language
359
L is a finite union of congruence classes; and we obtain an important saturation property:
Whenever w ∈ L, we define the set of words [w] to be all words in the same congruence
class of w. So, ρ([w]) plays the role of an open neighborhood around the graph ρ(w). Inside
each ρ([w]), we define finitely many “smallest” graphs. Thereby, we find a finite set of finite
graphs F such that the collection of these finitely many graphs still has the entire information
about ρ(L). In order to reveal that information, we construct for each F ∈ F a (possibl (...truncated)