---
title: 'GraphPaper Editor: Graph Visualization & Rewriting'
url: https://www.emergentmind.com/topics/graphpaper-editor
type: topic
---

# GraphPaper Editor: Graph Visualization & Rewriting

The term **GraphPaper Editor** refers to two functionally distinct but methodologically related systems for graph creation, visualization, and transformation: (1) the GraphPaper interface for interaction net rewriting in conjunction with TULIP, and (2) the planar_draw tool for rendering maps on orientable surfaces. These editors are unified by their emphasis on direct, visual, and manipulable representations of graphs and associated transformations, leveraging precise encoding and export pipelines for downstream computation or LaTeX integration [1003.4326][2505.01480].

## 1. Architectural Paradigms and Input Encodings

**GraphPaper (interaction nets)** operates as a lightweight, stand-alone editor enabling the direct drawing of agents, ports, and interaction-net rewriting rules using a “digital-paper” paradigm. Rather than toolbars or explicit mode toggles, user intent is inferred from drawn shapes and context, supporting rapid structural editing and manipulation [1003.4326].

**planar_draw** (termed “GraphPaper Editor” for maps) ingests combinatorial map encodings in the “planarcode” format, representing embedded graphs through rotation systems—each vertex’s cyclically ordered neighbors terminated by zero. For general surfaces, planar_draw requires an embedding; abstract graphs are first embedded using dedicated tools (e.g., multi_genus or multi_allembed) [2505.01480].

| Editor                    | Input Schema         | Initial Representation                     |
|---------------------------|---------------------|--------------------------------------------|
| GraphPaper/TULIP          | Hand-drawn nets     | Agents, ports, rules, strategies           |
| planar_draw (“GraphPaper Editor”)   | planarcode (rotation)    | Embedded map on orientable surface         |

This design allows both editors to integrate with computational systems: GraphPaper exports to TULIP for rewriting execution; planar_draw produces TikZ output for LaTeX workflows.

## 2. User Interface and Interaction Models

**GraphPaper** applies a free-hand digital-paper metaphor: circles create agents; overlapping circles yield lasso-selection; connecting two ports with a line creates an edge; lines “sticking out” establish auxiliary ports at the drawn position. Port management is automatic—labeling an agent with arity $n$ results in $n+1$ ports (principal plus auxiliaries), enumerated $0\ldots n$, with principal port always at zero [1003.4326].

There are two primary states:  
- **Draw state** (shape recognition for agent/port/edge creation and deletion)  
- **View/Edit state** (object selection, renaming, panning, zooming, deletion via lasso)

**Rule-drawing mode** is triggered by lasso-selecting two agents at principal ports; the user then draws the rule’s right-hand side and matches free ports explicitly.

**planar_draw** operates via command-line flags and modifies rendering options in the TikZ header. Readers select the location of the fundamental polygon’s “common center,” tune which edges/faces are intersected by non-contractible cycles, and apply color or label styles to polygonal boundary segments or nodes [2505.01480].

## 3. Graph Representation and Rewrite Models

GraphPaper formalizes **interaction-net systems** as $(\Sigma, R)$ where $\Sigma$ is a finite set of agent symbols (with fixed arity) and $R$ is a set of binary interaction rules. Each agent is depicted as a circle with $n+1$ labeled ports, uniquely identifying principal and auxiliary positions. In LaTeX notation, left-hand sides are rendered as
$$
\alpha\;\bowtie\;\beta \longrightarrow N
$$
with explicit bijection between free ports of the active pair and the replacement net [1003.4326].

Rewrite semantics are strictly local: when two agents $\alpha, \beta$ meet at principal ports, and a rule $\alpha \bowtie \beta \mapsto N$ matches the interface, the region is replaced with $N$ with free port correspondences preserved. This yields strong confluence—any two reductions commute and no critical pairs arise.

planar_draw, by contrast, represents combinatorial maps on orientable surfaces. Each embedding specifies oriented edges and a rotation (the “n” map) encoding clockwise succession at vertices. The genus is recovered via the Euler characteristic $|V| - |E| + |F| = 2 - 2g$; non-contractible cycles are used to cut the surface into a fundamental $4g$-gon for planarization [2505.01480].

## 4. Algorithmic Pipelines and Visualization Workflows

**GraphPaper/TULIP Workflow:**  
1. **Draw nets** using gestures; automatically manage ports/edges.  
2. **Define rules** via lasso and explicit right-hand-side drawing.  
3. **Specify strategies** using a domain-specific language (DSL) for rule application sequencing, depth, and interface targeting.
4. **Export to TULIP**, which implements over a dozen dynamic layout algorithms and provides a visual trace of each rewrite step.  
5. **Simulate and debug**: dynamic rendering, strategy execution, branching trace-tree navigation, alternate layouts, and interactive state inspection [1003.4326].

**planar_draw Workflow:**  
1. **Pre-process** graphs in edge-list to generate one or all embeddings.  
2. **Fundamental polygon cutting**: identify $2g$ non-contractible cycles sharing a center, cut to produce a $4g$-gon.  
3. **Coordinate assignment and quality control**:  
   - Triangulate faces (Delgado-Friedrichs),  
   - Apply Tutte’s barycentric embedding with fixed polygon boundary,  
   - Spring-embedder refinement,  
   - Accept/retry based on minimal separation constraints.  
4. **Polygon and cycle rendering**: boundaries as arcs or straight lines, color or text-label matching sides, annotate cycle crossings.  
5. **Customization**: options to dictate face/edge centers, forbid certain edge-cuts, color by degree, and parameter tuning in TikZ header.  
6. **TikZ Output** for LaTeX document inclusion [2505.01480].

## 5. Strategy Languages and Rule Application

**GraphPaper/TULIP** provides a strategy DSL for rewriting control, supporting constructs:
- Identity and failure,
- Targeted rule application ($R_i$(subgraph, depth)),
- Sequential ($S_1;S_2$) and parallel ($S_1 \| S_2$) composition,
- Iteration ($S^*$),
- Choice ($S_1$ or $S_2$).

Helpers include Interface(sub) (the set of free ports) and Successors(sub) (union of subgraph and neighbors). The DSL is used to encode complex strategies such as
\[
\bigl(R_{\text{add-S}}[\mathrm{Interface}(M_0),1]\;\text{or}\;R_{S-S}[M_0,0]\bigr);(R_{\text{clean}})^*[M_0,{-1}]
\]
which specifies a prioritized rule application at the interface, followed by exhaustive application of a cleaning rule [1003.4326].

planar_draw does not itself implement rewriting or rule computation; it is a rendering system parameterized by combinatorial and geometric options.

## 6. Integration, Output, and Downstream Applications

**GraphPaper** exports system data (graphs/rules/strategies) to TULIP, which is extended by a dedicated port/rewrite plugin implementing pattern-matching (by scanning for principal-principal connections, i.e., redexes), incremental rewriting, and dynamic visual trace generation. All graph, rule, and trace state is maintained as subgraphs of a root in TULIP, providing persistent navigation and inspection of the entire computational history [1003.4326].

**planar_draw** produces TikZ code for embedding in LaTeX documents, supporting adjustment of style parameters and explicit annotation of combinatorial structures: colored or labeled polygon sides, colored vertices by degree, and annotated boundary crossings of non-contractible cycles. Preprocessing and embedding steps are chainable via Unix pipelines with companion programs [2505.01480].

| Feature               | GraphPaper/TULIP                       | planar_draw (“GraphPaper Editor”)           |
|-----------------------|----------------------------------------|---------------------------------------------|
| Output                | System for interactive computation, rewrite trace, visual debugging | TikZ LaTeX source of map or embedding       |
| Extension/Integration | TULIP plugin (rewriting, layout, trace) | Third-party embedding tools plus TikZ post-processing |
| Typical Use-Cases     | Interaction net system development, symbolic graph rewriting, protocol/algorithm prototyping | Visualization of embeddings/maps on surfaces, publication-quality figures |

## 7. Context and Significance

Both GraphPaper and planar_draw embody principled approaches to graph editing and visualization in mathematically rigorous settings:

- **GraphPaper/TULIP** advances the specification and execution of interaction net based computations, supporting both direct manipulation and controlled strategic rewriting in a strongly confluent, local setting suitable for algorithmic exploration and correctness analysis [1003.4326].
- **planar_draw** extends the capacity of researchers to visualize and document combinatorial maps on arbitrary orientable surfaces, preserving both combinatorial and topological information in a publication-ready format while allowing explicit geometric customization and encoding [2505.01480].

A plausible implication is that these editors facilitate the bridging of abstract formal models with concrete computational and visual workflows, supporting both teaching and research in domains that require explicit, accurate graph encoding and transformation.

Source: https://www.emergentmind.com/topics/graphpaper-editor