OK, so I assume you have already sorted that Array of Nodes to be in the order that you want. For each Node (other than the last one), call Node.findLinksOutOf and iterate over that collection of Links to see if the other Node (Link.toNode) is later in your Array of Nodes. If so, set Part.isHighlighted to true.
Separately, you’ll want to make sure your Link template does something so that each link shows that it is highlighted.