transfer_links function

Annotate the direct upstream or downstream node on the edges