code: def calculate_leaf_paths(self):
          
          reverse_xref = {}
          leaves = set()
          for v in self.value.values():
              if v.leaf:
                  leaves.add(v)
              for xref in v.value_xref:
                  reverse_xref.setdefault(xref, []).append(v.ident)
          for leaf in leaves:
              self.calculate_leaf_path(leaf, reverse_xref)
docs: Build map of reverse xrefs then traverse backwards marking path to leaf for all leaves.