Add isPredecessor to check whether a node is another's predecessor.