Skip to content
Graphviz (DOT) templates

Commutative Diagram

A standard commutative square showing morphism composition.

Template previewGraphviz (DOT)
cd A A B B A->B f C C A->C g D D B->D h C->D k

What this template contains

Graph
Directed
Edges
4
Source
14 lines

Make it your own.

digraph cd {
  rankdir=LR;
  graph [bgcolor=transparent];
  node [shape=plain, fontname=Inter, fontsize=14];
  edge [fontname=Inter, fontsize=10];

  A [label="A"]; B [label="B"];
  C [label="C"]; D [label="D"];

  A -> B [label="f"];
  A -> C [label="g"];
  B -> D [label="h"];
  C -> D [label="k"];

  { rank=same; A B }
  { rank=same; C D }
}