Public
Edited
Mar 26, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
a_to_b = "a->b"
Insert cell
t1 = dot_fragment_2_svg( a_to_b ) // new (hopefully more intuitive) API name for "digraph2svg" below
Insert cell
t2 = digraph2svg( a_to_b ) // old and deprecated name for above
Insert cell
t3 = dot2svg( "digraph {" + a_to_b + "}" ) // explicit call including what is omitted by dot_fragment_2_svg
Insert cell
t4 = dot2svg( "graph { a--b }" ) // identical result compared to above - I just prefer the "->" syntax for edges
Insert cell
Insert cell
t5 = dot_fragment_2_svg( `
${a_to_b}`
) // if DOT source contains line break(s), then KTS will apply its default bottom-up layout (see user guide)
Insert cell
right_to_left = "rankdir=RL right->left"
Insert cell
t6 = dot_fragment_2_svg( right_to_left ) // explicit layout per DOT attribute (NOT recommended KTS practise)
Insert cell
t = dot_fragment_2_svg( `
${ right_to_left }
` ) // also DOT source that includes linebreak(s)
Insert cell
t8 = dot_fragment_2_svg( "rankdir=TD top->down" ) // explicit layout per DOT attribute (NOT recommended KTS practise)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
css
Insert cell
{
init( t1 ) // make the 1st diagram interactive to verify node + edge ID convention, which is needed for graph traversal

visco.press("Escape")
visco.press("Escape")

return "done"
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more