arXiv:2610.06244cs.LGOct 2026

Manuscript Offprint

arXiv:2610.06244

Constrained Goal-directed Planar Graph Generation with Grammar-based Reinforcement Learning

Nicolas Hochuli, Lorenzo Miele, Kristina Shea, Tino Stankovic

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Nicolas Hochuli*

Engineering Design and

Computing Laboratory

ETH Zürich

Lorenzo Miele*

Engineering Design and

Computing Laboratory

ETH Zürich

Kristina Shea

Engineering Design and

Computing Laboratory

ETH Zürich

Tino Stankovic

Engineering Design and

Computing Laboratory

ETH Zürich

Abstract

Planar graphs are central to applications across science and engineering, yet existing generators provide limited support for goal-directed generation under hard structural and geometric feasibility constraints. We propose a dataset-free method for generating planar graph embeddings by combining parametric graph grammars with safe reinforcement learning to optimize generic task-specific objectives while satisfying constraints during construction. We formulate the generation process as a constrained Markov decision process, where the graph grammar defines the state and action spaces. We further introduce an action projection that maps sampled actions toward state-dependent safe sets, improving constraint satisfaction during training. In contrast to classical graph generators and deep generative models, which typically offer limited goal-directed control or rely on weak constraint satisfaction, our method constructs feasible planar graph embeddings directly during generation. We also introduce a benchmark suite for constrained and goal-directed planar graph generation, together with classical and deep generative baselines. Across all benchmark tasks, our method consistently outperforms baselines while satisfying the formulated constraints.

1 Introduction

Goal-directed planar graph generation is a central research topic in computer science, with applications spanning urban planning and road-network design [1, 2, 3], engineering design, including architecture, structural optimization, origami design [4, 5, 6, 7, 8] as well as computational mesh-generation [9]. In many of these applications, graphs are not merely abstract combinatorial representations of relational data, but require explicit planar embeddings whose structure must be optimized for task-specific objectives under hard structural and geometric constraints. Despite this need, methods for systematically generating goal-directed embedded planar graphs while enforcing hard constraints remain limited in performance or tailored to domain-specific settings [10].

Classical graph generators [11, 12, 13] and specialized planar graph generators [14, 15] provide tractable random graph models, including samplers for well-defined planar graph families. However, they are not generally designed for goal-directed multi-objective optimization nor do they construct

*Equal contribution. Correspondence to nhochuli@ethz.ch

Code is available at https://github.com/ETHZ-EDAC/constrained-graph-rl.

Preprint.

Figure

Figure 1: Sequential planar graph generation. Starting from an initial graph G0G_0, a policy samples rule-based actions at∼π(at∣Gt)a_t \sim \pi(a_t \mid G_t) from a safe action space, enabling valid graph generation at each step. Actions modify graphs topologically and geometrically based on a predefined graph grammar.

valid planar graph embeddings under hard constraints. Deep generative models [10, 16, 17] can learn graph distributions and support property-conditioned generation [18], but they require training data which induces distributional biases and typically handle hard structural or geometric feasibility through soft conditioning, rejection sampling or post-processing. In contrast, autoregressive models, reinforcement learning, and hybrids of both have been used for sequential graph construction under hard validity constraints, especially in molecular design [19, 20, 21, 22, 23]. Yet many of these methods rely on discrete topological actions or domain-specific validity rules with relatively small graph instances, leaving generic and larger scale goal-directed generation of embedded planar graphs under hard constraints an open challenge.

Here, we propose a generic dataset-free method for goal-directed embedded planar graph generation across varying graph sizes. The method combines parametric graph grammars with safe reinforcement learning (Figure 1). We formulate the generation process as a Constrained Markov Decision Process (CMDP) whose state and action spaces are induced by the grammar. The grammar defines graph rewriting rules with continuous parameters, while an agent learns to apply these rules sequentially to optimize user-specified multi-objective rewards. Since graph size is controlled directly through sequential rule applications and termination criteria, our method can generate graphs with an exact prescribed number of nodes, a requirement that is difficult to enforce in many distributional graph generators. To improve feasibility during learning, we introduce a differentiable action projection that maps sampled actions toward state-dependent safe sets. The method constructs the planar embedding subject to hard constraints during generation, enabling controllable synthesis of planar graph embeddings for settings where multiple optimization objectives jointly matter. We additionally propose a new benchmark suite for constrained goal-directed embedded planar graph generation, that covers a wide variety of graph properties involving geometric, topological and spectral graph metrics.

References (61)