how to tell which book node is the root node programatically If I have some nodes that are of type book, how can I go through them in a php script and tell which is the root?  thanks
You can try to build the menu tree for your book. Book nodes do not have direct parents. The relationship is defined by the menu structure.

This will give you the structure of the book menu.

$book = $node-&gt;book;
$tree = menu_tree_all_data(book_menu_name($book['bid']));