I'm trying to highlight all the connected links and links of their target nodes till the end of the layout.
The first level of highlighting can be easily achieved as follows -
On node click, call highlight_paths(1)
;
function highlight_paths(stroke_opacity) {
return function(d,i){
d.sourceLinks.forEach(function(srcLnk){
d3.select("#link"+srcLnk.id).style("stroke-opacity", stroke_opacity);
});
d.targetLinks.forEach(function(srcLnk){
d3.select("#link"+srcLnk.id).style("stroke-opacity", stroke_opacity);
});
}
}
But I'm not yet able to write correctly a recursive algorithm to get all the sourceLinks and targetLinks of each of the connected source & target nodes.
All thoughts are appreciated!
Thanks.