First question: yes, calculations of type “media” could return a UUID array. Second question: you could use that for the tree, but I think the tree wants a UUID string array, not a UUID object array.
You could fairly easily calculate the full path to the root when you have a given node. In the node you could do something like this in a calculation (out of my head)
function tree_path() {
if (utils.hasRecords(relation_to_parent)) {
var parentPath = relation_to_parent.tree_path;
parentPath.push(node_id);
return parentPath;
} else {
return [node_id]
}
}