graph = {
let current = 0,
N = chaos.descendants().length;
const view = d3.create("div").style("user-select", "none");
function draw(node) {
view
.html("")
.node()
.appendChild(
digraph(
chaos.copy()[order]((d, i) => {
d.label = `${d.data.id} ${i === 0 ? "*" : ""}`;
d.style = i === current ? "filled" : "";
return d;
})
)
);
}
const increment = () => draw((current = ++current % N));
view.on("click", increment);
d3.select(document.body).on("keyup", increment);
draw();
return view.node();
}