Greetings!
Yes indeed. The mouse click listener should be attached to the data table. When that handler gets invoked, that logic needs to make the changes to the graph visualization that you desire. From how you describe it, it seems that the graph data itself will not need to change (meaning the layout of the nodes and links will stay the same), only you want to highlight something in the graph based on what is clicked? In that case, the click handler can call a function that selects the elements you want to highlight and change their color or whatever you want to do to indicate that they are the ones selected.
A sketch/mockup of the desired view after clicking would be helpful as well, to make sure folks really understand what you are trying to do. Also the technical approach depends on what frameworks you are using - if React is in play you could put the highlight logic in a useEffect
call, if it’s purely D3 you’ll want to either make an idempotent function that can be invoked with the configured state again and again, or write one function to set up the graph and a separate function to do the highlighting (the latter approach is probably simpler).
Also, another option for getting help is to ask this question in the D3 Slack #help channel https://d3-slackin.herokuapp.com/ There is a great community there that is very helpful in cases like this.
Good luck!