Papers
Topics
Authors
Recent
Search
2000 character limit reached

Logical Computation Graphs Overview

Updated 10 July 2026
  • Logical Computation Graphs are graph-structured representations that compile logical expressions into explicit computational objects for precise and efficient query evaluation.
  • They employ various structures—such as dependency DAGs, query trees, and path-based transformer models—to address complex logical queries and optimize computation.
  • Empirical evaluations across methods like GQE, CaQR, QTO, and Pathformer show significant performance gains and scalability in diverse query answering settings.

Searching arXiv for recent and foundational papers on logical computation graphs and related query computation graph methods. arxiv_search(query="logical computation graph knowledge graph query computation tree Pathformer CaQR GQE QTO", max_results=10) arxiv_search(query="Pathformer recursive path query encoding complex logical query answering", max_results=5) Logical computation graphs are graph-structured representations in which logical expressions are compiled into explicit computational objects. In knowledge-graph reasoning, a First-Order-Logic query can be represented as a directed acyclic query graph Gq=(Vq,Eq)G_q=(V_q,E_q), a dependency graph DqD_q, or a directed rooted query computation tree whose leaves are anchor entities or constants and whose root is the free answer variable (Kim et al., 2024, Hamilton et al., 2018, Bai et al., 2022). In other settings, computational objects are expressed as graphs with interfaces, proofs of multiplicative linear logic are interpreted as interaction graphs, and arbitrary undirected graphs are treated as generalized Boolean formulas in Boolean Graph Logic (Dixon et al., 2010, Seiller, 2012, Calk et al., 2020). A plausible unifying description is that logical structure is made explicit as graph topology, and evaluation proceeds by composing local operators attached to nodes, edges, or paths.

1. Query graphs, dependency DAGs, and computation trees

In complex logical query answering over knowledge graphs, the basic formal object is a graph representation of a FOL query. CaQR defines a FOL conjunctive/disjunctive query as a directed acyclic query graph Gq=(Vq,Eq)G_q=(V_q,E_q) with Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}, where Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V are fixed entities, Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\} are existentially quantified intermediate variables, and V?V_? is the target answer variable; each edge (u,r,v)(u,r,v) encodes an atomic formula r(u,v)r(u,v) or its inverse (Kim et al., 2024). GQE gives the equivalent dependency-graph view: a kk-ary conjunctive query with one free variable is associated with a dependency graph DqD_q0, a directed acyclic graph whose nodes are anchor nodes, bound variables, and the free variable DqD_q1, and whose edges are relational atoms (Hamilton et al., 2018).

The query computation tree is a stricter tree-shaped compilation. In QTO, a FOL query with conjunction, disjunction, negation, and existential quantifiers is rewritten in Disjunctive Normal Form, and the resulting query computation tree DqD_q2 has leaf nodes that are constant entities and internal nodes of four types: relational projection, anti-relational projection, intersection, and union; its edges point from children up toward the root DqD_q3 (Bai et al., 2022). Pathformer uses a closely related query computation tree DqD_q4 for Existential First-Order Logic queries with a single free variable, where nodes are leaf anchor entities or branch-variable nodes and edges are decorated with relational projection DqD_q5 or atomic negation DqD_q6; the root DqD_q7 holds the final answer set (Zhang et al., 2024).

These formulations differ in granularity but agree on the role of topology. Prior embedding-based methods compile DqD_q8 into a tree-shaped computation graph where each edge applies a learned projection or a set operation, whereas Pathformer emphasizes a tree-like computation graph with branch structure and QTO emphasizes a tree that exposes conditional independence for optimization (Kim et al., 2024, Zhang et al., 2024, Bai et al., 2022).

2. Core operators and evaluation semantics

GQE formulates logical computation directly in a shared DqD_q9-dimensional Euclidean space. Graph nodes are embedded as

Gq=(Vq,Eq)G_q=(V_q,E_q)0

and two differentiable operators are composed over the dependency DAG: a relation-specific projection Gq=(Vq,Eq)G_q=(V_q,E_q)1, instantiated either as Gq=(Vq,Eq)G_q=(V_q,E_q)2 or, in a TransE-style version, Gq=(Vq,Eq)G_q=(V_q,E_q)3, and a symmetric intersection operator

Gq=(Vq,Eq)G_q=(V_q,E_q)4

A topological pass initializes each anchor to its node embedding, propagates projected messages along edges, applies intersection when all incoming edges to a node have arrived, and produces a query embedding Gq=(Vq,Eq)G_q=(V_q,E_q)5 at Gq=(Vq,Eq)G_q=(V_q,E_q)6. Candidate answers are ranked by cosine score Gq=(Vq,Eq)G_q=(V_q,E_q)7, and training uses max-margin ranking with hard negatives for intersection queries (Hamilton et al., 2018).

CaQR summarizes the standard per-branch operators used by the main embedding families. In Q2B, a set of entities is represented by a box with center Gq=(Vq,Eq)G_q=(V_q,E_q)8 and offset Gq=(Vq,Eq)G_q=(V_q,E_q)9, projection is

Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}0

intersection uses the mean of centers and the maximum of offsets, and scoring uses Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}1. In ConE, a set is encoded as 2-D cones with axis Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}2 and aperture Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}3, with relation projection by rotation and scaling and scoring by angular distance plus radial distance to axis. In BetaE, each variable set is a product of independent Beta distributions parameterized by Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}4, projection is given by relation-specific MLPs Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}5 and Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}6, intersection is point-wise product, and scoring uses Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}7 (Kim et al., 2024).

QTO replaces learned geometric composition with a forward-backward optimization over truth-score vectors. Each node Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}8 receives Vq=Vanchor∪Vexist∪{V?}V_q = V_{\text{anchor}} \cup V_{\text{exist}} \cup \{V_?\}9, where Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V0 is the maximal probability of the subquery at Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V1 conditioned on Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V2. Intersection uses elementwise products, union uses Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V3, relational projection uses

Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V4

and anti-relational projection replaces Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V5 by Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V6. After a forward pass to the root and a backward pass to recover intermediate assignments, QTO returns Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V7 (Bai et al., 2022).

3. Path decomposition, bidirectional encoding, and context injection

Pathformer addresses the mismatch between sequence models and branch-structured logical queries by decomposing the query computation tree into path queries. Because Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V8 is a tree, each non-leaf node is a fork node with two or more children; a depth-first traversal from every leaf anchor toward the root, cut whenever a fork is reached, yields branch paths of the form

Vanchor⊆VV_{\text{anchor}}\subseteq\mathcal V9

with Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}0. Each path is turned into a token sequence consisting of the start-node embedding, learned relation vectors Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}1, and a special token Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}2 for negation. A standard Transformer encoder with Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}3 layers, multi-head self-attention, and position encoding then produces a path-query embedding

Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}4

where the bidirectional attention mechanism allows future operators and relations to influence earlier tokens. At fork nodes, Pathformer fuses incoming path embeddings by an MLP intersection network,

Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}5

applied pairwise when there are more than two branches, and recursively assembles a final one-point embedding Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}6. Answer scoring uses Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}7 distance,

Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}8

and training uses a margin-based logistic loss with positive and negative answers (Zhang et al., 2024).

CaQR keeps the base operator family unchanged and instead augments each intermediate node with two explicit context vectors. The structural context Vexist={V1,…,Vk}V_{\text{exist}}=\{V_1,\dots,V_k\}9 combines a position embedding V?V_?0, a role embedding V?V_?1, and a query-type embedding V?V_?2 obtained from a normalized V?V_?3 count table of V?V_?4 pairs, followed by an V?V_?5. The relation-induced context V?V_?6 is computed by sampling up to V?V_?7 entities from KG head and tail neighborhoods associated with the incident query relations, aggregating frozen entity embeddings into V?V_?8 and V?V_?9, and averaging them. Fusion is model-agnostic: (u,r,v)(u,r,v)0 and (u,r,v)(u,r,v)1 replaces the original intermediate representation for subsequent logical operators (Kim et al., 2024).

The two methods differ in where they introduce global information. Pathformer pushes future context into each branch by bidirectional self-attention over path sequences, whereas CaQR injects structural context and relation-induced context at every projection step of an existing base model. This suggests two distinct strategies for logical computation graphs: reparameterizing the computation graph itself, or enriching node states while retaining the original operators (Zhang et al., 2024, Kim et al., 2024).

4. Locality, independence, and algorithmic complexity

A central motivation for logical computation graphs is to avoid exhaustive enumeration over existential assignments. GQE makes this explicit in its complexity analysis. If (u,r,v)(u,r,v)2 is the number of edges in the query DAG (u,r,v)(u,r,v)3, Algorithm 1 performs exactly (u,r,v)(u,r,v)4 calls to (u,r,v)(u,r,v)5 and at most (u,r,v)(u,r,v)6 calls to (u,r,v)(u,r,v)7. A single projection costs (u,r,v)(u,r,v)8, or (u,r,v)(u,r,v)9 in the TransE variant, and a single intersection costs r(u,v)r(u,v)0. The total time is r(u,v)r(u,v)1, linear in the query size and independent of r(u,v)r(u,v)2, whereas naive enumeration over r(u,v)r(u,v)3 bound variables costs r(u,v)r(u,v)4 (Hamilton et al., 2018).

QTO exploits independence encoded in the query computation tree. Because r(u,v)r(u,v)5 is a tree, any two disjoint subtrees under a conjunction or disjunction are conditionally independent given the value of their common parent variable. The factorization

r(u,v)r(u,v)6

allows each subtree to be solved locally, removing the need to enumerate joint assignments and collapsing an exponential search into a sequence of r(u,v)r(u,v)7 local maximizations. In implementation terms, each r(u,v)r(u,v)8 or r(u,v)r(u,v)9 node costs kk0, while each projection node costs kk1 naively or kk2 with sparse storage (Bai et al., 2022).

Pathformer offers a different locality argument. By unfolding the EFOL tree into per-branch paths, it avoids trying to encode a full graph in one pass, which would require elaborate positional schemes or graph-transformers. Every encoded sequence is a simple path, negation is represented by a single kk3 token, and fork MLPs reassemble multiple path views of the same variable in an intersection-like fashion (Zhang et al., 2024).

These results delimit a common design space. Standard linear sequential operations are efficient but, in CaQR’s formulation, do not adapt to the global query structure or to node-specific KG context; exact tree optimization is feasible when independence is exposed; and path-based transformer encoders trade direct graph encoding for repeated sequence encoding over tree branches (Kim et al., 2024, Bai et al., 2022, Zhang et al., 2024).

5. Empirical behavior in complex logical query answering

The reported empirical results span different datasets, query families, and scoring protocols, so they are not directly interchangeable. They nonetheless show that changes to the logical computation graph—whether geometric, contextual, transformer-based, or optimization-based—alter answer quality measurably (Hamilton et al., 2018, Zhang et al., 2024, Kim et al., 2024, Bai et al., 2022).

Method Dataset / setting Reported result
GQE Bio AUC kk4, APR kk5
GQE Reddit AUC kk6, APR kk7
Pathformer FB15k-237 EPFO queries overall MRR kk8
Pathformer NELL995 avg MRR kk9
CaQR + Q2B NELL Avg MRR DqD_q00
CaQR + BetaE FB15k-237 DqD_q01
QTO 3 datasets previous best results improved by an average of DqD_q02

GQE demonstrated that training on complex queries, including paths and intersections, yields a DqD_q03 absolute AUC gain over an edge-only baseline, and that the framework scales to a biomedical graph with DqD_q04 nodes, DqD_q05 relation types, and DqD_q06 million edges as well as a Reddit graph with DqD_q07 nodes and DqD_q08 million edges (Hamilton et al., 2018).

Pathformer reports that it consistently outperforms competitive neural QE methods on standard CLQA benchmarks FB15k-237 and NELL995. On FB15k-237 EPFO queries it achieves an overall Mean Reciprocal Rank of DqD_q09, versus DqD_q10 for FuzzQE and DqD_q11 for GammaE; on NELL995 the average MRR is DqD_q12 versus DqD_q13 for MLP-Mixer. It also leads on zero-shot held-out structures such as DqD_q14, DqD_q15, DqD_q16, and DqD_q17, and compared to BIQE is described as both more accurate and easily extending to queries with negation (Zhang et al., 2024).

CaQR reports consistent gains across Q2B, BetaE, and ConE. The largest stated improvement is on NELL with Q2B, where the Avg MRR goes from DqD_q18 to DqD_q19, corresponding to DqD_q20. On FB15k-237, BetaE improves from DqD_q21 to DqD_q22 and ConE from DqD_q23 to DqD_q24. QTO, evaluated on 3 datasets, is reported to obtain state-of-the-art performance on complex query answering, outperforming previous best results by an average of DqD_q25, and to interpret the intermediate solutions for each of the one-hop atoms in the query with over DqD_q26 accuracy (Kim et al., 2024, Bai et al., 2022).

6. Expressiveness, graph logic, and broader semantic frameworks

Logical computation graphs also appear as an expressiveness lens for neural graph models. The logic DqD_q27, the DqD_q28-dimensional Weisfeiler-Leman algorithm, and higher-order message-passing GNNs form equivalent descriptions of the same isomorphism-invariant distinguishing power. For standard message-passing GNNs, any DqD_q29-layer architecture refines the DqD_q30-round color refinement DqD_q31, so no such GNN can distinguish vertices or graphs that 1-WL still considers equivalent; conversely, recurrent GNNs with sum aggregation can simulate color refinement. For higher-order models, DqD_q32-GNNs operating on DqD_q33-tuples match standard DqD_q34-WL and hence the logic DqD_q35. The paper summarizes this as a unifying computation-graph perspective: counting quantifiers map to local degree-counts, variable-reuse up to DqD_q36 corresponds to the width of tuple lifting, quantifier-rank corresponds to the number of GNN rounds, and invariance under renaming corresponds to parameter sharing across the graph (Grohe, 2021).

Outside knowledge-graph query answering, graph-based logical computation supports denotational semantics and proof theory. In interaction graphs, proofs of multiplicative linear logic are represented by directed weighted multigraphs DqD_q37, composed by plugging and analyzed through alternating paths, 1-circuits, and the measurement

DqD_q38

Projects and conducts then yield tensor, linear implication, orthogonality, truth, and ultimately a DqD_q39-autonomous category; a restricted fragment recovers Girard’s geometry of interaction in the hyperfinite factor (Seiller, 2012).

Boolean Graph Logic pushes the formula-as-graph perspective further by lifting cograph-based Boolean formulas to all finite undirected graphs. A graph DqD_q40 computes a binary relation DqD_q41 via maximal cliques and maximal stable sets, evaluation is NP-complete for arbitrary graphs, and entailment is DqD_q42-complete. The framework also provides a recursive evaluation algorithm by modular decomposition, a game-theoretic characterization in terms of static and sequential strategies, and a deep-inference-style axiomatization with soundness and completeness (Calk et al., 2020).

Open graphs provide a compositional calculus for computational objects with interfaces made of half-edges. Inputs, outputs, and boundary embeddings define interfaces; plugging is implemented by pushouts in the category of open graphs; and rewrite rules between graphs with the same boundary support algebraic reasoning about Boolean circuits and other computational models. The theory establishes soundness and completeness properties for rewriting and identifies the resulting diagrammatic systems with free symmetric strict monoidal categories generated by a signature and equations (Dixon et al., 2010).

A recurrent misconception is that logical computation graphs are necessarily trees or formula cotrees. The surveyed literature is more heterogeneous: some frameworks insist on tree structure because it exposes efficient local composition or exact optimization, while others explicitly generalize from cographs to arbitrary graphs, from formula trees to open graphs with half-edge interfaces, or from proof nets to interaction graphs with path-based semantics (Bai et al., 2022, Calk et al., 2020, Dixon et al., 2010, Seiller, 2012).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Logical Computation Graphs.