Published
Edited
Jun 11, 2020
1 star
Insert cell
Insert cell
g = {
const g = new G.Graph({ compound: true })
g.setNode("1", { id: 1 })
g.setNode("2")
g.setEdge("1", "2")
return g
}
Insert cell
g.node("1")
Insert cell
g.hasNode("1")
Insert cell
G.alg.preorder(g, "1")
Insert cell
G.json.write(g)
Insert cell
Insert cell
Insert cell
tree = {
const g = new G.Graph({ directed: true, compound: true })
parents.forEach(([child, parent]) => {
g.setEdge(parent, child)
if (parent) {
g.setParent(child, parent)
}
})
return g
}
Insert cell
G.json.write(tree)
Insert cell
G.alg.preorder(tree, "7")
Insert cell
Insert cell
Insert cell
Insert cell
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