# Hybrid Model

Conventional four models has an interesting trade-off. The table below is a list whether can describe query to find a subtree and adjacency (parent and child) node smartly. Expresses an evaluation by ABC for expressing the hybrid model.

Model name | Find Subtree | Find Adjacency Node |
---|---|---|

Adjacency List Model | C | AA |

Path Enumeration Model | A | C |

Nested Set Model | A | C |

Closure Table Model | A | C |

Closure Table Model and Nested Set Model are excellent in searching subtree, but can not describe query to find adjacency node smartly. In contrast, Adjacency List Mode can not describe query to find subtree, but it exerts the performance to find adjacent nodes worthy of its name.

Against this situation, there is a way of thinking such as:

It can be summarized as "the best of both worlds". It is very reasonable. In fact, the part of the library that implements the model storing hierarchical data in RDB is designed to contain two kind of hierarchical structure columns as:

- Parent column of the adjacency list model
- Left and right columns of nested set model

Combines the above two, the hybrid model can describe smart query to find both (subtree and adjacent nodes).