I've developed NEAT evolve package for javascript. Now I'm trying to make example page html to show how evolving makes classigication. Help me to make changes: Draw network graph with svg and d3: * Use svg to display network graph * Graph must be inside container #best-network * Input nodes must have fixed coordinates on the left side of container from top to bottom * Output nodes must have fixed coordinates on the right side of container from top to bottom * Graph must have responsive width with min width 400px and fixed height 300px * Input nodes must have pastel blue color, output nodes must have pastel green color, nodes with type hidden must be gray pastel color * Every node (except type input) must have text with it's squash function * Connections with positive weight must have patel green color, connections with negative weight must have pastel red color My first code here to help you: var drawInitted = false; const drawNetwork = (network, results, width = 400, height = 400, container = "svgContainer") => { if (drawInitted && results.iteration % 1000 !== 0) { return } drawInitted = true; var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .attr("id", "best-network"); const preparedNodes = network.nodes.map((n, idx) => { const node = n.toJSON(); node.index = idx; return node; }); const connections = network.connections.map((c, idx) => { const fromIndex = network.nodes.indexOf(c.from); const toIndex = network.nodes.indexOf(c.to); return { source: preparedNodes[fromIndex], target: preparedNodes[toIndex], weight: c.weight, enabled: true } }); function getNodeWithIndex(node) { const index = network.nodes.indexOf(node); const currNode = node.toJSON(); currNode.index = index; return currNode; } var force = d3.layout.force() .gravity(.05) .distance(100) .charge(-100) .size([width, height]); const inputs = preparedNodes.filter((n) => n.type == 'input'); const outputs = preparedNodes.filter((n) => n.type == 'output'); const endNodes = [].concat(inputs, outputs); const nodes = preparedNodes.map((node) => { // if (node.type == 0) { if (node.type == 'input') { node.fixed = true; node.y = height - (height * 0.2); node.x = ((width / inputs.length) * inputs.indexOf(node)) + (width / inputs.length) / 2; // node.x = ((width / network.input) * node.index) + (width / network.input) / 2; } if (node.type == 'output') { node.fixed = true; node.y = (height * 0.2); // node.x = ((width / network.output) * (node.index - network.input)) + (width / network.output) / 2; node.x = ((width / outputs.length) * (endNodes.indexOf(node) - inputs.length)) + (width / outputs.length) / 2; } return node }) force.nodes(nodes) .links(connections) .start(); var link = svg.selectAll(".link") .data(connections) .enter().append("line") .attr("class", "link") .style("stroke-width", function (d) { return d.enabled ? (d.weight > 0 ? 0.3 + d.weight : 0.3 + d.weight * -1) : 0 }) .style("stroke", function (d) { return d.weight > 0 ? "#0f0" : "#f00"; }); var node = svg.selectAll(".node") .data(nodes) .enter().append("g") .attr("class", "node") .call(force.drag); node.append("circle") .attr("r", "5") .attr("fill", function (d) { if (d.type === 'input') { return '#00f' } else if (d.type === 'output') { return '#f00' } else { return '#000' } }); node.append("text") .attr("dx", 12) .attr("dy", ".35em") .text(function (d) { return d.index + (d.type !== 'input' ? "(" + d.squash + ")" : null) }); force.on("tick", function () { link.attr("x1", function (d) { return d.source.x; }) .attr("y1", function (d) { return d.source.y; }) .attr("x2", function (d) { return d.target.x; }) .attr("y2", function (d) { return d.target.y; }); node.attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; }); }); // var element = document.getElementById(this.id); document.getElementById(container) .innerHTML = ''; var element = document.getElementById("best-network"); document.getElementById(container) .append(element); }