function greedyLabeller(label_coords, xScale, yScale, p){
var L = label_coords.slice();
var popSplit = p.popSplit;
var textSize = p.textSize;
var textSize2 = p.textSize2;
var bufferSizeX = p.bufferSizeX;
var bufferSizeY = p.bufferSizeY;
L.forEach(d =>{
var svg = html`<svg style="border:solid 0px red;"><g name="content"><text font-size="
${((d.P > (1e6 * popSplit)) ? textSize : textSize2)}">
${DOM.text(d.Name)}
</text></g></svg>`;
document.body.appendChild(svg);
var box = svg.querySelector("[name=content]").getBBox();
d.boxWidth = box.width;
d.boxHeight = box.height;
svg.remove();
})
L.forEach(d => d.display = false);
for(var ii in d3.range(L.length)){
var d = L[ii];
var myTop = yScale(d.Y)-d.boxHeight;
var myBot = yScale(d.Y);
var myLeft = xScale(d.X)-d.boxWidth/2;
var myRight = xScale(d.X)+d.boxWidth/2;
var soFarSoGood = true;
console.log(L.filter(d => (d.display == true)))
for (var T of L.filter(x => x.display)){
var theirTop = yScale(T.Y)-T.boxHeight;
var theirBot = yScale(T.Y);
var theirLeft = xScale(T.X)-T.boxWidth/2;
var theirRight = xScale(T.X)+T.boxWidth/2;
if((theirRight<myLeft-bufferSizeX)|
(theirLeft>myRight+bufferSizeX)|
(theirTop>myBot+bufferSizeY)|
(theirBot<myTop-bufferSizeY)){
soFarSoGood &= true;
}else{
soFarSoGood &= false;
}
}
L[ii].display = soFarSoGood;
}
return L
}