Skip to content

predictygraph

Predictable graphs. Diagrams as readable text, laid out the way you said, styled with plain CSS.

A developer adds one box and the diagram turns to spaghetti. A buff guy bursts through the wall with diagram.pdg, and the diagram comes out the same way every time.

  • Start here

    Install, write your first diagram, render it.

    Getting started

  • Learn the language

    Layouts, edges, styling, annotations, themes and animation, one page each.

    Guide

  • See what it can do

    Architecture diagrams, flowcharts and the usual Mermaid diagram types.

    Gallery

  • Look something up

    The full language spec, every command-line option, editor setup.

    Reference

HAMi scheduling flow

Mermaid and Graphviz rearrange your whole picture when you change one box. predictygraph doesn't: each group picks its own layout, so a change stays where you made it.

A taste

# SPDX-FileCopyrightText: 2026 Hulk Predicty
#
# SPDX-License-Identifier: CC-BY-4.0

graph dir=LR route=ortho
css "theme.css"

user "Data scientist"
group k8s "Kubernetes cluster" layout=layered dir=TB {
  api "kube-apiserver"
  sched "HAMi scheduler" .hami
  api -> sched
}
group gpus "GPU nodes" layout=grid cols=2 {
  default node .gpu
  g0 "A100"; g1 "A100"; g2 "H100"; g3 "H100"
}
user -> api "submit pod"
sched ==> gpus "bind" .hot

The snippet above, rendered

Style it like a network planner with the trunkline theme, animated flows and fan=spread branches:

# Dual-path backbone on the trunkline theme: draw-in route, ring flows, background grid.
graph dir=LR theme=trunkline route=ortho radius=0 diagonal=always grid=40 rank-gap=170 balance=center
dc "Data center" sub="GPU racks"
group fabric "Spine fabric" .rail layout=column gap=60 {
  spa "Spine A" sub="400G"
  spb "Spine B" sub="400G"
}
group svc .list layout=column align=start {
  obj "Object store" sub="S3 · 4 PB"
  train "Training cluster" sub="512 × H100"
  infer "Inference" sub="vLLM pool"
  feat "Feature store" sub="Redis"
  log "Logging" sub="Loki"
  peer "Peering" sub="IX · 2 × 100G"
}
dc -> spa "primary" .primary flow=forward flow-speed=.9s
dc -> spb "backup" .backup flow=forward flow-speed=1.4s
spa -> spb .primary flow=forward flow-speed=1.2s
spa -> obj, infer fan=spread stub=24
spa -> train .primary fan=spread stub=24 flow=draw flow-speed=2.5s
spb -> feat, log, peer fan=spread stub=24

The snippet above, rendered

Reuse a block with def and use, and share values with let:

# SPDX-FileCopyrightText: 2026 Hulk Predicty
#
# SPDX-License-Identifier: CC-BY-4.0

graph dir=LR route=ortho
css "theme.css"
let model = "H100"

def server gpus=2 {
  cpu "CPU"
  gpu "${model} x${gpus}" .gpu
  cpu -> gpu
}

sched "HAMi scheduler" .hami
group rack "Rack" layout=column {
  use server node1 "Node 1"
  use server node2 "Node 2" gpus=8
}
sched -> node1-cpu, node2-cpu

The snippet above, rendered

Why predictygraph

  • Readable diffs. One statement per line. No XML, no coordinates.
  • Mix layouts. Each box arranges its own contents. Put a grid of servers inside a step-by-step flow, and a circle of nodes inside that grid.
  • Plain CSS. Style with the CSS you know. No browser, no JavaScript.
  • Same input, same picture. Every viewer shows the same SVG.
  • Animated when you want it. Moving edges and pulsing borders, in a single small SVG file.
  • Themes included. Twelve colour themes, from Nord to Catppuccin. See them all.