As suggested by paxRoman, in order to remove a node you can do:


Now, to find empty nodes, what you can do is use the weight property of force nodes as explained in the documentation of the force layout:

weight - the node weight; the number of associated links.

So, finally, in order to get all nodes that are empty you can do:


with force being your force layout.

Please also notice that the weight property will only be initialized on force.start() call as explained in the documentation:

These attributes do not need to be set before passing the nodes to the layout; if they are not set, suitable defaults will be initialized by the layout when start is called

Related Query