code: def reverse_path(dict_, root, child_to_parents):
      
      # Hacky but illustrative
      # TODO; implement non-hacky version
      allkeys = get_allkeys(dict_)
      mat = np.zeros((len(allkeys), len(allkeys)))
      for key in allkeys:
          if key != root:
              for parent in child_to_parents[key]:
                  rx = allkeys.index(parent)
                  cx = allkeys.index(key)
                  mat[rx][cx] = 1
      end = None
      seen_ = set([])
      reversed_ = {root: traverse_path(root, end, seen_, allkeys, mat)}
      return reversed_
docs: CommandLine:
          python -m utool.util_graph --exec-reverse_path --show
  
      Example:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_graph import *  # NOQA
          >>> import utool as ut
          >>> child_to_parents = {
          >>>     'chip': ['dummy_annot'],
          >>>     'chipmask': ['dummy_annot'],
          >>>     'descriptor': ['keypoint'],
          >>>     'fgweight': ['keypoint', 'probchip'],
          >>>     'keypoint': ['chip'],
          >>>     'notch': ['dummy_annot'],
          >>>     'probchip': ['dummy_annot'],
          >>>     'spam': ['fgweight', 'chip', 'keypoint']
          >>> }
          >>> to_root = {
          >>>     'fgweight': {
          >>>         'keypoint': {
          >>>             'chip': {
          >>>                 'dummy_annot': None,
          >>>             },
          >>>         },
          >>>         'probchip': {
          >>>             'dummy_annot': None,
          >>>         },
          >>>     },
          >>> }
          >>> reversed_ = reverse_path(to_root, 'dummy_annot', child_to_parents)
          >>> result = ut.repr3(reversed_)
          >>> print(result)
          {
              'dummy_annot': {
                  'chip': {
                      'keypoint': {
                          'fgweight': None,
                      },
                  },
                  'probchip': {
                      'fgweight': None,
                  },
              },
          }