adjacencyMatrix = {
const svg = d3.create('svg')
.attr('width', matrixWidth)
.attr('height', matrixHeight);
const xAxis = d3.axisTop(x).tickSize(0);
svg.append("g")
.attr('transform', `translate(0,${margin.top})`)
.call(xAxis)
.call(g => g.selectAll(".domain").remove())
.append("text")
.attr("x", margin.left + (matrixWidth - margin.left - margin.right) / 2)
.attr("y", -margin.top + 5)
.attr("fill", "black")
.attr("text-anchor", "middle")
.attr("dominant-baseline", "hanging")
.text("Target");
const yAxis = d3.axisLeft(y).tickSize(0);
svg.append("g")
.attr('transform', `translate(${margin.left})`)
.call(yAxis)
.call(g => g.selectAll(".domain").remove())
.append("text")
.attr("x", -margin.left)
.attr("y", margin.top + (matrixHeight - margin.top - margin.bottom) / 2)
.attr("fill", "black")
.attr("dominant-baseline", "middle")
.attr("text-anchor", "start")
.text("Source");
svg.selectAll('rect')
.data(populationFlows)
.join('rect')
.attr('x', d => x(d.target))
.attr('y', d => y(d.source))
.attr('width', x.bandwidth())
.attr('height', y.bandwidth())
.attr('fill', d => populationColor(d.population));
return svg.node();
}