It's not needed - although you're question has made me realize I don't need to used closed_families here at all.  In the graph view, any node that is there to be clicked on is by definition not closed.  The only nodes that can't be closed are those whose parent is root (I should set the menu item insensitive in that case); and the only ones that can't be ungrouped are tasks (that now works properly, although as just mentioned it shouldn't be necessary to use closed families to determine that) ... I'll finish this off tomorrow.