Top-nodes algorithm


The top-nodes algorithm is an algorithm for managing a resource reservation calendar. The algorithm has been first published in 2003, and has been improved in 2009. It is used when a resource is shared among many users.
The algorithm allows users to:
The calendar is stored as a binary tree where leaves represent elementary time periods. Other nodes represent the period of time covered by all their descendants.

Example of a seven-hour calendar

The period of time covered by a reservation is represented by a set of "top-nodes". This set is the minimal set of nodes that exactly cover the reservation period of time.
A node of the binary tree is a "top-node" for a given reservation if

Top-nodes for a reservation from 1:00 to 5:59

The following value is stored in each node:
q = max, q)
+ total amount of reserved resource for all reservations having this node as a "top-node"

Performance

The advantage of this algorithm is that the time to register a new resource reservation depends only on the calendar size.
Let be the number of elementary periods in the calendar.
The maximal number of "top-nodes" for a given reservation is 2.log n.
where is the number of reservations that are active during the added calendar periods.