The category tree is build in a hierarchical structure of all categories from a client.
The first category level of the tree always starts with the parentid 0, otherwise it is a subcategory. In the example picture of the standard installation the categories at the first level (parentid 0): "Main Navigation" (idcat 1), "Head navigation" (idcat 39), "Servicenavigation" (idcat 4) and "System Pages" (idcat 2).
The param preid defines if a category is the first sub category (value is 0) or not (value is another idcat). For example "Philosphy" (idcat 5) is the first sub category from the "Main navigation" (idcat 1) category and "Just Publish" (idcat 54) is the first sub category from the category "Philosophy" (idcat 5).
If the preid of a category is not 0 then it is always the category id of the previous category in the hierarchial level. For example the preid of the "Search results" category (idcat 26) is not 0 because it isn´t the first sub category but it is 25 because the previous category is the "Error Page" category with the idcat 25.
The param postid is analog to the param preid but defines always the last category (value is 0) or the successive category (value is another idcat). In this example the last sub category of the "Head navigation" category (idcat 39) is the category where the param postid is 0 thus the "Login" (idcat 41). If the postid of a category is not 0 the param always contains the id of the successive category. For example the param postid of the category "Sitemap" (idcat 47) is 41 because the successive category is category "Login" with the id 41.