Automatically determining the top-most node

Is there a general way of determining the top-most node/person in a given repository via the UI? Via the CLI?

Whether coincidence or not, our family tree has about six-hundred people in it and Gramps always happens to jump to the root person when first opened. I’m curious if there is an over function to show them later on in the session after you’ve clicked away. Accessing this from the UI with help manual usage. Accessing this from the CLI would support automation/analysis, and it’d be nice if this functionality was already built-in to Gramps (as opposed to finding another or writing the traversal routine ourselves).

Some helpful navigation aids you seem not to be aware of.

Home Person. This is the person that Gramps will jump to when the House toolbar icon is clicked. (People views is the ones with this option.) To set the home person, you can right-click within the person’s edit window (in the region where Tags are displayed) to set that person as Home. In the People and Grouped People list there is the menu option >> Edit >> Set Home Person.

Next option is all views allow you to bookmark any record for easier navigation to desired/needed records. Each view has the menu option.

In Preferences (menu >> Edit >> Preferences) There are several options that will be helpful. On the General tab - Remember last view displayed

There is also a Third Party Addon Restore History that when installed will remember where you were in each of the navigation views from your previous Gramps session. If you were working on Aunt Mary yesterday, when you launch Gramps today, Gramps will take you to Aunt Mary. It works on all Navigation views.

EDIT: Now reading some of your other recent posts (@dsoprea ) this post probably misunderstood what you were asking.

What are you calling the top-most node/person?

Your oldest ancestor?

Sort People view by birth date then run an ancestor filter. The first (or last depending on sorting order) will be that oldest ancestor (if birth date have been entered).

I don’t have this issue because of my numbering/ordering system, I just sort people records by Gramps Id and it’s done. The greatest IDs give me my oldest ancestors.
or retreiving last ids with a simple regexp filter:

There are some features which key their behavior on the active object in each category view. However, only the Person category is persistent between sessions. (The Active Person and separate Home Person are stored.)

There is also a Preferences option to Restore Last View when restarting Gramps. So the Active object in a particular Tree and category is stored for that feature. But that’s probably too useless for any other purpose.

The Session Log gramplet and Go Menus track most recently selected objects. But they are flawed in tbis logging capacity as newly created objects are not pushed into into either list. You have to sort the flat list view mode on ‘Last Modified’ to discover newly created objects.

You might want to explore the code of @cdhorn 's set of experimental CardViews. He had to make decision about how to determine Active record and what to use as a fallback for when no record was active.

Whether you use the Home Person (sometimes referred to as the Default Person), or Tags, or Bookmarks, there are corresponding filter rules you can use to create a custom filter, for reports that let you specify a filter.

I would assume that that’s just a coincidence, or a consequence of how it initially builds the tree. Presumably you could prove the lack of a guarantee by adding a parent on your previous, highest node and confirm that it now has the greatest ID while now concurrently new root node.

Correct. I was looking for a UI feature (for convenience) or an algorithm (for automated processes) to determine it.

I expecting to be able to simply find the the first node that had no assigned parent node. That’s usually the standard (as well as the most efficient) method of identifying the root node in a hierarchy.

Gramps stores a general graph. Sub-graphs are not always connected.

And I’m not sure what you mean by “first node”. Individual nodes (Persons) are not sorted, although you could choose to sort on the ID. But the ID is arbitrary and has no documented semantics beyond uniqueness.

The hierarchy within the framework of a genealogy which takes an inverted tree form (from bottom to top - contrary to what we are used to seeing as a military or corporate hierarchy, with an organization chart from top to bottom), the parent node that doesn’t have one itself is rather yourself (if you are the subject of this genealogy). Since the ancestors of this base node are divided into branches, you can have as many nodes with final singletons as there are branches in the tree. I would therefore say that the “top-most” is you, in fact the “least”, and that you will therefore find as many (in fact double) clever nodes as branches. You may then want to sort these endpoints in order to find the one born the longest ago for example, but there is no guarantee that you will not have several meeting this criteria.

Got it. Thanks for explaining. Do you think/see this as [still] optimizing some important operations against the tree or that it ended-up being an unfortunate design decision?