Each edge connects two nodes . Store a mapping edge_to_node[i] that tells you which node stores edge . This is the child node in the parent-child pair. When you read edge with endpoints , determine which is the parent using depth or parent array.
Store edge at the child node. To update edge to , find v = edge_to_node[i] and update pos[v] in the segment tree to . This is a single point update.