Highlight all ancestors of current node

I’ve got a TreeLayout diagram. When a user’s mouse enters a node, I want the links connected to all ancestors and children of that node to get highlighted.

I know TreeLayouts only define the parent relationship, but is there a way to walk the tree up from here (and down through children nodes as well)? Screenshot of my diagram attached for reference.

First, I should mention that the Distances and Paths sample, http://gojs.net/latest/samples/distances.html, might be of interest to you. It shows one way of highlighting the nodes and links along a given path, which is held as a List of Links.

Second, you can traverse a tree towards the root by repeatedly calling Node.findTreeParentNode. You can go towards the children by calling Node.findTreeChildrenNodes.

If you look at the documentation for the Node class, http://gojs.net/latest/api/symbols/Node.html, there is a list of all of the methods that apply to traversing a tree.

Thanks for the guidance Walter!