Skip to content

Latest commit

 

History

History
48 lines (39 loc) · 949 Bytes

README.md

File metadata and controls

48 lines (39 loc) · 949 Bytes

Process

This graph was created from a hand-made figure in an operating system paper.

Code

import { Graph, toDot } from 'ts-graphviz';

const g = new Graph('G');

g.set('layout', 'neato');
g.edge(['run', 'intr']);
g.edge(['intr', 'runbl']);
g.edge(['runbl', 'run']);
g.edge(['run', 'kernel']);
g.edge(['kernel', ['zombie', 'sleep', 'runmem']]);
g.edge(['sleep', 'swap']);
g.edge(['swap', 'runswap']);
g.edge(['runswap', 'new']);
g.edge(['runswap', 'runmem']);
g.edge(['new', 'runmem']);
g.edge(['sleep', 'runmem']);

toDot(g);

Result

graph "G" {
  layout = "neato";
  "run" -- "intr";
  "intr" -- "runbl";
  "runbl" -- "run";
  "run" -- "kernel";
  "kernel" -- {"zombie" "sleep" "runmem"};
  "sleep" -- "swap";
  "swap" -- "runswap";
  "runswap" -- "new";
  "runswap" -- "runmem";
  "new" -- "runmem";
  "sleep" -- "runmem";
}

result