---
title: Free-Connex Acyclic Conjunctive Queries
url: https://www.emergentmind.com/topics/free-connex-acyclic-conjunctive-queries-fc-acqs
type: topic
---

# Free-Connex Acyclic Conjunctive Queries

A free-connex acyclic conjunctive query (fc-ACQ) is a pivotal structural notion in the theory of conjunctive query (CQ) evaluation, capturing precisely the class of self-join-free acyclic CQs for which constant-delay enumeration and linear-time preprocessing are achievable. This property is characterized by the requirement that the query’s hypergraph remains acyclic when augmented with a hyperedge over the head (free) variables. The following comprehensive article presents the key definitions, complexity dichotomies, enumeration algorithms, generalizations, width measures, and applications to related domains.

## 1. Structural Definition and Characterization

Let $Q(\bar{x}) \leftarrow R_1(\bar{v}_1), ..., R_m(\bar{v}_m)$ be a self-join-free CQ over a relational schema. Associate to $Q$ a hypergraph $H(Q) = (V,E)$, where $V$ is the set of all variables appearing in the query, and $E$ is the set of variable sets in each atom, i.e., $E = \{\operatorname{vars}(\bar{v}_i)\mid i=1,...,m\}$.

A hypergraph is **acyclic** if it admits a join tree, i.e., a tree whose nodes are the hyperedges, such that for every variable $x \in V$, the set of edges containing $x$ induces a connected subtree. 

$Q$ is **free-connex acyclic** (fc-ACQ, sometimes also "free-connex") if:
- $H(Q)$ is acyclic
- Adding a new hyperedge $X = \operatorname{free}(Q)$ (the set of head variables) to form $H^+(Q) = (V, E \cup \{X\})$ preserves acyclicity

Equivalently, $Q$ fails to be free-connex exactly when there exists a chordless path (a head-path) in $H(Q)$ connecting two distinct free variables with all internal nodes non-free (i.e., a "head-path" of length at least 2) [1712.07880, 1812.03831].

## 2. Enumeration Complexity Dichotomies and Lower Bounds

**Enumeration Dichotomy (Bagan–Durand–Grandjean 2007, Brault-Baron 2013):**

Let $Q$ be a self-join-free acyclic CQ. Then:
- If $Q$ is free-connex, one can enumerate all answers $Q(I)$ with $O(|I|)$ preprocessing and $O(1)$ delay per answer (i.e., $\text{Enu}_Q \in$ DelayClin).
- If $Q$ is acyclic but non-free-connex, under the Boolean matrix multiplication conjecture, constant-delay enumeration after linear preprocessing is impossible [1712.07880, 1912.10704, 1812.03831, 2112.01108].

A clear frontier emerges: **fc-ACQs are the unique maximal class of self-join-free acyclic CQs admitting enumeration in linear preprocessing and constant delay**.

**Counting Dichotomy:**
- For fc-ACQs, counting the answers can also be done in $O(|D|)$ time.
- If the query’s "quantified star size" (see §5) is $k \geq 2$, $\Omega(|D|^k)$ time is needed under fine-grained complexity conjectures [2112.01108].

## 3. Algorithms for Enumeration and Counting

The classical evaluation of fc-ACQs is based on Yannakakis’s algorithm and join trees [1812.03831, 1712.07880, 1912.10704]:

### Preprocessing (O(|D|) Time)
- Compute a join tree $T$ of $H^+(Q)$.
- For each atom and for each pair of neighboring hyperedges in $T$, build indexes keyed by shared variables. This uses sorting or hashing and is done in linear time.

### Enumeration (Constant Delay)
- Perform a depth-first traversal of $T$.
- For each tree node:
  - Maintain an iterator over the tuples of its relation consistent with the assignments fixed in the parent.
  - At the root, pick the first tuple.
  - For each child, use the index to jump to matching tuples, recurse.
  - When all children are fixed, output the projection to the free variables.
  - Advance the lowest-level node’s iterator with a next tuple, reset all children’s iterators, and repeat.

The height of $T$ is bounded by $Q$, so each step costs $O(1)$, ensuring constant delay.

**Counting Algorithm:** Use dynamic programming along the join tree, bottom-up, so that each bag computes the number of partial answer extensions. For fc-ACQs the recurrence is O(1) per bag; total $O(|D|)$ [2405.12358, 2601.04757].

## 4. Width Measures and Generalizations

### Free-Connex Fractional Hypertree Width (fc-fhtw)
Let (T,χ) be a join-tree, $χ(t) \subseteq \operatorname{vars}(Q)$. The **fc-fhtw(Q)** is the minimal (over free-connex decompositions) maximum fractional edge-cover number among the bags in the decomposition [2512.11129]. For acyclic fc-ACQs, fc-fhtw$(Q)=1$. Output-sensitive complexity of (C)RPQs is governed by this parameter:
- Runtime $O(N+N \cdot OUT^{1-1/\max(w,2)} + OUT)$, where $w = \text{fc-fhtw}(Q)$, $N$ is input size, and $OUT$ is output size.

### Submodular Width
More generally, constant-delay enumeration is possible for bounded **free-connex submodular width** (fc-SUBW), which collapses to 1 precisely for fc-ACQs [2003.01075].

### Quantified Star Size
For acyclic CQs, the quantified star size equals 1 if and only if the query is free-connex. Quantified star size $k$ implies worst-case lower bound $\Omega(m^k)$ for counting, where $m$ is input size [2112.01108].

## 5. Extensions to Broader Query Classes and Indexing

### Unions of CQs (UCQs)
Enumeration with linear preprocessing/constant delay for UCQs is more subtle. A UCQ is **free-connex** if each disjunct can be made free-connex by "borrowing" (i.e., using union extensions) from other disjuncts. All such UCQs admit DelayClin enumeration [1812.03831].

### Functional Dependencies, Cardinality and DL Roles
For queries with functional dependencies (FDs) or similar dependencies (e.g., unary FDs, key constraints, DL functional roles), one first computes the FD-extension of $Q$ by “chasing” the dependencies, adjusts the head as needed, and checks free-connex acyclicity of the extended query. If this holds, DelayClin enumeration is retained [1712.07880, 2211.15248, 1812.03831].

### Conjunctive Queries with Negation and Aggregation
The notion of **free-connex signed-acyclicity** strictly generalizes fc-ACQ to the case of queries with negation. For self-join-free queries with negation or aggregates (FAQ$^-$), enumeration and aggregation remain tractable—linear preprocessing and constant delay—if and only if the underlying signed hypergraph is free-connex signed-acyclic [2310.05385].

### Index Structures: Structural and Color-based Indexing
Recent work establishes efficient database-side index structures for fc-ACQs:
- **Structural indexing via color refinement:** Build an auxiliary database $D_{col}$ encoding the coarsest stable coloring of the input domain under Weisfeiler--Leman color refinement. For any fc-ACQ $Q$, the answer can be enumerated or counted in time $O(|Q| \cdot |D_{col}|)$, which may be sublinear in $|D|$ for regular or highly symmetric data [2601.04757, 2405.12358].

| Input Structure        | Index Size | Preprocessing | Per-Query Cost    | Reference        |
|-----------------------|------------|---------------|-------------------|------------------|
| General database      | $|D|$      | $O(|D|)$      | $O(|D|)$          | [1812.03831]     |
| Structural indexing   | $\le|D|$   | $O(|D|\log|D|)$| $O(|Q|\,|D_{col}|)$| [2601.04757]     |
| Regular graphs        | $O(1)$     | $O(1)$        | $O(|Q|)$          | [2601.04757]     |

## 6. Applications in Database and Linear Algebra Query Evaluation

### Linear Algebra (MATLANG)
fc-ACQs exactly characterize the fragment of first-order logic expressible as tree-shaped join patterns, corresponding to a fragment of MATLANG (Sum-MATLANG) expressions ("FC-MATLANG") that admit constant-delay enumeration after linear preprocessing on sparse semiring-annotated matrices [2310.04118].

### Query Rewriting, View Selection, and Optimization
Deciding whether an acyclic CQ admits an acyclic or free-connex acyclic rewriting is NP-hard in general. However, if all views are fc-ACQ, rewritability checking becomes tractable for bounded arity schemas. This has immediate implications for view selection and query optimization in data integration [2201.05129].

## 7. Illustrative Examples

| Query Type                | Definition                                         | Query Graph/Hypergraph    | Free-Connex? | Complexity           |
|---------------------------|---------------------------------------------------|---------------------------|--------------|----------------------|
| $Q_1(x,y) \gets R(x,z), S(z,y)$  | Two binary atoms, head $(x,y)$          | Path, plus $(x,y)$ edge   | Yes          | DelayClin, O(1) delay|
| $Q_2(x,y) \gets R_1(x,z_1), R_2(z_1,z_2), R_3(z_2,y)$ | Chain, head $(x,y)$  | Path, plus $(x,y)$ edge creates a cycle | No           | Hard unless BMM breaks |

- For regular graphs (e.g., cycles): the color-refinement based $D_{col}$ reduces to a single color; query evaluation on $|Q|$ plus constant delay [2601.04757, 2405.12358].
- In contrast, for random graphs with no symmetry, $|D_{col}| = \Theta(|D|)$ and the method reduces to classical costs.

## References

- [1712.07880] Enumeration Complexity of Conjunctive Queries with Functional Dependencies
- [1812.03831] On the Enumeration Complexity of Unions of Conjunctive Queries
- [1912.10704] Answering (Unions of) Conjunctive Queries using Random Access and Random-Order Enumeration
- [2112.01108] A short note on the counting complexity of conjunctive queries
- [2310.04118] Enumeration and updates for conjunctive linear algebra queries through expressibility
- [2201.05129] Rewriting with Acyclic Queries: Mind Your Head
- [2310.05385] Conjunctive Queries with Negation and Aggregation: A Linear Time Characterization
- [2003.01075] Constant delay enumeration with FPT-preprocessing for conjunctive queries of bounded submodular width
- [2211.15248] Efficient Answer Enumeration in Description Logics with Functional Roles -- Extended Version
- [2512.11129] Acyclic Conjunctive Regular Path Queries are no Harder than Corresponding Conjunctive Queries
- [2601.04757] Structural Indexing of Relational Databases for the Evaluation of Free-Connex Acyclic Conjunctive Queries
- [2405.12358] Using Color Refinement to Boost Enumeration and Counting for Acyclic CQs of Binary Schemas

In summary, free-connex acyclic conjunctive queries are deeply connected to tractability frontiers in fine-grained enumeration and counting complexity, admit robust characterizations via tree decompositions, and underpin optimal algorithms and indexing strategies for conjunctive query processing across logic, databases, and linear algebra systems.

Source: https://www.emergentmind.com/topics/free-connex-acyclic-conjunctive-queries-fc-acqs