Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 1.56 KB

t4.md

File metadata and controls

35 lines (30 loc) · 1.56 KB

Tutorial4 sample Nested Set Model solution:

Another way of representing trees is to show them as nested sets. i.e. Uses containment represents subordination. The drawing below shows the organisation chart tree structure represented as nested sets:

nested-set

We can then model the org units chart with number pairs left and right value as shown below:

                        +---------+
                        |  Albert |
                        | 1     18|
                        +----+----+
                             |
          +------------------+--------------+
          |                                 |
      +---+-----+                      +----+----+
      |   Bert  |                      |  Chuck  |
      | 2     9 |                      | 10    17|
      +----+----+                      +----+----+
           |                                |
    +------+------+           +--------------------------+
    |             |           |             |            |
+---+-----+  +----+----+  +---+-----+  +----+----+  +----+----+
|   Jane  |  |   Joe   |  |  Donna  |  |  Eddie  |  |   Fred  |
| 3     4 |  | 5     8 |  | 11    12|  | 13    14|  | 15    16|
+---------+  +----+----+  +---------+  +---------+  +---------+
                  |
             +----+----+
             |   Max   |
             | 6     7 |
             +---------+

The sample rego code can be found from policies/tutorials/t4