digraph ExclusiveScan {

  rankdir = TB;
  graph [fontname="Courier New", fontsize=12, ranksep=0.55, nodesep=0.05];
  node  [fontname="Courier New", fontsize=12, style=filled, shape=box,
         height=0.35, margin="0.10,0.05"];
  edge  [arrowsize=0.7];

  sp1 [style=invis, width=0.01, height=0.01, label=""];
  sp2 [style=invis, width=0.01, height=0.01, label=""];
  sp1 -> sp2 [style=invis, weight=50];

  // ── input row ─────────────────────────────────────────────────────────────
  { rank=same;
    sp1;
    lbl_in [label="input", shape=plaintext, fillcolor=white,
            fontname="Helvetica Bold", fontsize=12, width=0.9];
    i0 [label="1",  fillcolor="#fde8d0", width=0.42];
    i1 [label="2",  fillcolor="#fde8d0", width=0.42];
    i2 [label="3",  fillcolor="#fde8d0", width=0.42];
    i3 [label="4",  fillcolor="#fde8d0", width=0.42];
    i4 [label="-2", fillcolor="#fde8d0", width=0.42];
    i5 [label="1",  fillcolor="#fde8d0", width=0.42];
    i6 [label="8",  fillcolor="#fde8d0", width=0.42];
    lbl_in->i0->i1->i2->i3->i4->i5->i6 [style=invis];
  }

  // ── exclusive output row ──────────────────────────────────────────────────
  { rank=same;
    sp2;
    lbl_out [label="exclusive\nscan (init=0)", shape=plaintext, fillcolor=white,
             fontname="Helvetica Bold", fontsize=12, width=0.9];
    e0 [label="0",  fillcolor="#cce5ff", width=0.42];
    e1 [label="1",  fillcolor="#cce5ff", width=0.42];
    e2 [label="3",  fillcolor="#cce5ff", width=0.42];
    e3 [label="6",  fillcolor="#cce5ff", width=0.42];
    e4 [label="10", fillcolor="#cce5ff", width=0.42];
    e5 [label="8",  fillcolor="#cce5ff", width=0.42];
    e6 [label="9",  fillcolor="#cce5ff", width=0.42];
    lbl_out->e0->e1->e2->e3->e4->e5->e6 [style=invis];
  }

  // ── init=0 feeds e0 directly ──────────────────────────────────────────────
  init0 [label="init=0", shape=plaintext, fontname="Helvetica",
         fontsize=12, fillcolor=white, style=filled];
  { rank=same; init0; sp1; }
  init0 -> e0 [color="#1a5fa8", style=dashed];

  // ── arrows: output[k] excludes input[k], shifted one right ───────────────
  edge [color="#1a5fa8", style=dashed, weight=1];
  i0 -> e1;
  i1 -> e2;
  i2 -> e3;
  i3 -> e4;
  i4 -> e5;
  i5 -> e6;
}

