---
name: create_node_mapping
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def create_node_mapping(tree: list[dict]) -> dict[str, dict]"
description: "Crea dict plano node_id->node para lookup O(1) en un arbol jerarquico."
tags: [tree, mapping, index, lookup, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
params:
  - name: tree
    desc: "lista de dicts representando arbol jerarquico con campos node_id y nodes"
output: "dict con node_id como keys y nodos como values para lookup O(1)"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/core/core.py"
source_repo: "https://github.com/VectifyAI/PageIndex"
source_license: "MIT"
source_file: "pageindex/utils.py"
---

## Ejemplo

```python
tree = [{"node_id": "0001", "title": "A", "nodes": [{"node_id": "0002", "title": "B"}]}]
mapping = create_node_mapping(tree)
mapping["0002"]["title"]  # "B"
```

## Notas

Funcion pura. Los valores son referencias a los nodos originales, no copias.
