Graph Theory37 sections · 1633 units
Open in Course

QTREE - Edge Update

Change edge $i$ to weight $ti$

Each edge ii connects two nodes (u,v)(u, v). Store a mapping edge_to_node[i] that tells you which node stores edge ii. This is the child node in the parent-child pair. When you read edge ii with endpoints (u,v)(u, v), determine which is the parent using depth or parent array.

Store edge ii at the child node. To update edge ii to titi, find v = edge_to_node[i] and update pos[v] in the segment tree to titi. This is a single point update.