D3.js node.ancestors() Function
The node.ancestors() function returns an array of ancestors nodes, starting with the given node, then followed by each parent up to the root. Syntax: node.ancestors(); Parameters: This method takes no parameters. Return Values: This method returns an array of ancestors nodes. Example 1: C/C++ Code