/ greg & arthur u:{@[x;y;:;&/y:x/y]} / connect tops v:{@[x;y;:;&/*|y:x\y]} / connect all nodes w:{@[x;y;:;&/(*|:)'y:x\'y]} / v, but do the paths separately ab:{(0;#*x)+/:&,/&':x} / above lf:{-1 0+/:&,/(0&':)'x} / left eq:{-1+(+\,/x)lf[x],ab x} / renumber equations h:{@[&1+|/x;x;+;1]} / histogram g:{[f;x]1_ h h{x/x}(!+//x)f/eq x} / apply algorithm f to x m:(0 0 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 0 0 1) g[u]m g[v]m g[w]m