code: def set_from_tree(root:str, graph:dict) -> frozenset:
      
      Node = namedtuple('Node', 'id succs')
      succs = graph[root]
      if succs:
          return (len(succs), sorted(tuple(set_from_tree(succ, graph) for succ in succs)))
      else:
          return 0, ()
docs: Return a recursive structure describing given tree