Skip to content
Graphviz (DOT) templates

Feed-Forward Neural Net

Fully-connected layers — input / hidden / output with weights.

Template previewGraphviz (DOT)
Rendering…

Make it your own.

digraph nn {
  rankdir=LR;
  graph [bgcolor=transparent, ranksep=1.5];
  node [shape=circle, style=filled, fontname=Inter, fontsize=10, fixedsize=true, width=0.6];

  // Input
  X1 [label="x1", fillcolor="#dbeafe"];
  X2 [label="x2", fillcolor="#dbeafe"];
  X3 [label="x3", fillcolor="#dbeafe"];

  // Hidden
  H1 [label="h1", fillcolor="#fef3c7"];
  H2 [label="h2", fillcolor="#fef3c7"];
  H3 [label="h3", fillcolor="#fef3c7"];
  H4 [label="h4", fillcolor="#fef3c7"];

  // Output
  Y1 [label="ŷ1", fillcolor="#dcfce7"];
  Y2 [label="ŷ2", fillcolor="#dcfce7"];

  { rank=same; X1 X2 X3 }
  { rank=same; H1 H2 H3 H4 }
  { rank=same; Y1 Y2 }

  X1 -> H1; X1 -> H2; X1 -> H3; X1 -> H4;
  X2 -> H1; X2 -> H2; X2 -> H3; X2 -> H4;
  X3 -> H1; X3 -> H2; X3 -> H3; X3 -> H4;
  H1 -> Y1; H1 -> Y2;
  H2 -> Y1; H2 -> Y2;
  H3 -> Y1; H3 -> Y2;
  H4 -> Y1; H4 -> Y2;
}