function draw(network, width, height, thickness){
const svg = d3.select(DOM.svg(width, height))
.classed('chart', true);
let pos = layout(network, width, height)
let thick = d3.scaleLinear().domain([Math.min(...network.edges.map(e => e.w)), 0, Math.max(...network.edges.map(e => e.w))]).range([thickness, 1, thickness])
let color = d3.scaleLinear().domain([Math.min(...network.edges.map(e => e.w)), 0, Math.max(...network.edges.map(e => e.w))]).range(['red', 'purple', 'blue'])
var link = svg
.selectAll(".line")
.data(network.edges)
.enter().append("line")
.attr("x1", d => pos(d.s).x)
.attr("y1", d => pos(d.s).y)
.attr("x2", d => pos(d.t).x)
.attr("y2", d => pos(d.t).y)
.attr("stroke-width", d => thick(d.w))
.attr("stroke", d => color(d.w))
var node = svg
.selectAll(".node")
.data(network.nodes )
.enter().append("circle")
.attr("id", (d => `n-${d.layer}-${d.id}`))
.attr("cx", d => pos(d.id).x)
.attr("cy", d => pos(d.id).y)
.attr("r", 25)
.attr("stroke", "black")
.attr("stroke-width", 2)
.attr("fill", "white")
return svg.node();
}