score:1

Accepted answer

I'd try something like

d3.selectAll(".link").attr("class", function(d) {
    var c = "link";
    if (d.source.visible && d.target.visible) { // or however you check the nodes?
        c += " visible";
    } else {
        c += " hidden";
    }
    return c;
});

For your scenario you might use if (selectedNodes.indexOf(d.source)...


Related Query