{
let g = dot`digraph {
S -> E -> I_1 -> I_2 -> I_3 -> D
I_1 -> R
I_2 -> R
I_3 -> R;
rankdir="LR";}`;
let graph_svg = d3.select(g);
let Y = parseInt(
graph_svg
.select('g')
.attr('transform')
.split(' ')
.slice(-1)[0]
);
for (let i = 1; i <= 7; i++) {
let text = graph_svg.select(`#node${i}`).select('text');
let x = text.attr('x');
let y = text.attr('y');
let tex_group = graph_svg
.append('g')
.attr('id', 'thetex2')
.attr(
'transform',
`translate(${x - 2} ${parseFloat(y) + Y - 10}) scale(0.9)`
)
.append(() =>
MathJax.tex2svg(String.raw`${text.text()}`).querySelector("svg")
);
text.remove();
}
return g;
}