---
name: format_tree_structure
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def format_tree_structure(structure: Any, order: list[str] = None) -> Any"
description: "Reordena campos de cada nodo de un arbol segun orden de claves especificado."
tags: [tree, format, order, structure, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
params:
  - name: structure
    desc: "arbol jerarquico (dict con campo 'nodes' anidado recursivamente)"
  - name: order
    desc: "lista de nombres de campos en el orden deseado para reordenar"
output: "estructura arbol con los campos de cada nodo reordenados segun order"
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 = [{"text": "...", "title": "Intro", "node_id": "0001"}]
format_tree_structure(tree, order=["title", "node_id", "text"])
# [{"title": "Intro", "node_id": "0001", "text": "..."}]
```

## Notas

Funcion pura. Elimina nodos vacios (nodes=[]) automaticamente. Claves no listadas en order se descartan.
