Struggling to clear my d3 force graph that is being plotted on an SVG in the following manner:
https://i.sstatic.net/V7hwu.png
I attempted clearing the svg using the following code snippet:
graph["links"] = [];
graph["nodes"] = [];
queryWords = [];
update();
Unfortunately, only the nodes get removed while the links continue to be displayed, despite having an empty force.links array as shown here:
https://i.sstatic.net/6YQ3m.png
If anyone has a solution to this issue, I would greatly appreciate it. Thank you.