build_jump_table

build_jump_table(serial_tree, max_depth=None, path_sep='/'): 

Scan visited_keys once and record, for every node (leaf or nested dict) up to max_depth, the (start, end) span in visited_keys and the block_pointers snapshot needed to resume unflatten_tree there directly.

Each entry also carries ‘key_path’: the full tuple of raw key_map ids from the root down to that node (not just its own terminal id). This is what lets _encode_jump_table serialize and later reconstruct the exact human path (“ep_001/obs”) rather than colliding on a shared terminal key name – key_map ids are shared across sibling records by design (e.g. every episode’s “obs” field uses the same id, since that’s what lets flatten_tree concatenate them into one array), so a terminal id alone can’t disambiguate “ep_000/obs” from “ep_001/obs”, but the full id path can.

  • serial_tree: Any

    flat-tree metadata and arrays (as returned by flatten_tree)

  • max_depth: Any

    if set, only index nodes at depth <= max_depth (0 = top-level records only). None indexes every node.

  • path_sep: Any

    separator used to join path components into a lookup key

  • :returns: _

    dict mapping path string -> {‘start’, ‘end’, ‘block_pointers’, ‘key_path’}


Feedback

Examples

Templates

Documentation