Files
fn_registry/cpp/functions/viz/sankey.md
T
egutierrez 47fac22230 chore: auto-commit (799 archivos)
- .claude/CLAUDE.md
- .claude/commands/subagentes.md
- .claude/rules/INDEX.md
- .mcp.json
- bash/functions/cybersecurity/analyze_dns.md
- bash/functions/cybersecurity/audit_http_headers.md
- bash/functions/cybersecurity/audit_ssh_config.md
- bash/functions/cybersecurity/check_firewall.md
- bash/functions/cybersecurity/detect_suspicious_users.md
- bash/functions/cybersecurity/encrypt_file.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:28:20 +02:00

2.1 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, framework, params, output, notes
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path framework params output notes
sankey component cpp viz 1.0.0 pure void sankey(const char* id, const std::vector<SankeyNode>& nodes, const std::vector<SankeyLink>& links, ImVec2 size) Sankey diagram para flujos source -> target con magnitudes. BFS topologico para columnas, bandas curvas (bezier cubico) para los links.
imgui
drawlist
chart
visualization
sankey
flow
dag
pendiente-usar
false
imgui
false
cpp/functions/viz/sankey.cpp imgui
name desc
id Identificador unico para PushID
name desc
nodes Vector de SankeyNode (label)
name desc
links Vector de SankeyLink {src, dst, value}. src/dst son indices en nodes
name desc
size Tamano del diagrama. x <= 0 usa el ancho disponible
Renderiza nodos como rectangulos verticales por columna y links como bandas con bezier cubico, con alpha bajo y color del nodo origen scaffolding/demo en primitives_gallery

sankey

Sankey diagram. Asigna nodos a columnas via BFS topologico (level = max(level(src))+1) y los apila verticalmente en cada columna proporcionalmente a max(in_total, out_total). Los links se renderizan como bandas curvas con bezier cubico, color del nodo origen + alpha bajo.

Limitaciones

  • Asume DAG (sin ciclos). Si hay ciclos, los nodos del ciclo se quedan en su nivel parcial calculado por BFS — el render no rompe pero puede solapar visualmente.
  • Sin orden de nodos optimizado para minimizar cruces (heuristica simple por orden de insercion).
  • Sin interaccion (hover, click).

Ejemplo

std::vector<SankeyNode> nodes = {
    {"clientes_premium"}, {"clientes_basicos"},
    {"laptops"}, {"phones"}, {"tablets"},
    {"hw"}, {"sw"},
};
std::vector<SankeyLink> links = {
    {0, 2, 80}, {0, 3, 30},
    {1, 3, 60}, {1, 4, 40},
    {2, 5, 80}, {3, 5, 90}, {4, 5, 40},
};
sankey("##flow", nodes, links, ImVec2(-1, 400));