Skip to main content

Yggdrasil

Yet another Good Graph for Dynamic ReAltime Scene Interaction and Learning.

Like Yggdrasil binding the Nine Realms, this system maintains the ‘world-tree’ of 3D scene data,
reconciling distributed updates and serving coherent subgraphs across heterogeneous agents.

arXiv Stars License CI Rust 2024 edition Python bindings

Paper · Book · Issues · Contributing


Try Yggdrasil

git clone https://github.com/brdsdsu/Yggdrasil.git && cd Yggdrasil
cargo run --release -p viz                   # explore the built-in demo scene in 3D
cargo run -p yggdrasil-3d --example demo     # the book's walkthrough, as one program

A layered 3D scene graph in the Yggdrasil visualizer

Building a graph and querying it takes a few lines:

use yggdrasil::{Coordinate, Feature, Observer, PosQueryCount, SceneGraph};

fn main() -> yggdrasil::Result<()> {
    let mut sg = SceneGraph::default();

    // Layers form a DAG: measured points sit under the objects they belong to.
    let points = sg.new_indexed_layer().id;
    let objects = sg.new_layer().id;
    sg.layer_mut(objects)?.add_child(points)?;

    // One semantic node, with three measured points nested under it.
    let car = sg.new_node(vec![Feature::new("type", "car")]);
    let car = sg.layer_mut(objects)?.push_node(car)?;
    for x in [0.0, 1.0, 2.0] {
        let point = sg.new_coordinates(x, 0.0, 0.0, vec![]);
        let point = sg.layer_mut(points)?.push_node(point)?;
        sg.nest(point).under(car)?;
    }

    // Spatial, semantic and field-of-view queries over the same graph.
    let nearest = sg.nearest_nodes(&Coordinate::new(0.9, 0.0, 0.0), PosQueryCount::Count(2));
    let cars = sg.nodes_matching(&[&Feature::new("type", "car")]);
    let camera = Observer::new_looking_along(Coordinate::new(-5.0, 0.0, 0.0), Coordinate::X, 0.5, 0.1, 6.0)?;
    let in_view = sg.visible_subgraph(&camera, car)?;
    Ok(())
}

The Yggdrasil Book builds a full demo scene and walks through every query family.


Why Yggdrasil

Without Yggdrasil With Yggdrasil
Spatial queries A k-d tree bolted on per project Nearest-neighbor, radius and field-of-view queries built in
Semantics Side tables keyed by id Key–value features on nodes, labelled edges between them
Hierarchy Ad-hoc parent pointers A layer DAG that decides what may nest under what
Derived state Recomputed by hand after every edit Bounding boxes and position indexes kept current on every change
Sharing with agents Ship the whole graph Extract the subgraph an agent needs, merge its updates back

The model

Layer → Nest → Index → Query

Step What happens
Layer new_layer() allocates an isolated graph of nodes and edges. add_child arranges layers into a DAG, from point clouds at the bottom to objects, rooms or a single root at the top. A layer can only be the child of a layer created after it.
Nest Nodes carry key–value features and, optionally, coordinates. nest(child).under(parent) builds the hierarchy, and is allowed only where the parent's layer is a parent of the child's layer. Edges stay within a layer.
Index Indexed layers and nodes keep a k-d tree over the coordinates beneath them; bounded nodes keep an axis-aligned box. Both update as nodes move, nest or detach.
Query Label, edge, nearest-neighbor, radius, field-of-view and subgraph queries, each at graph, layer or subtree scope.

How it works

   python-binding (PyO3)          viz (Bevy)          engine (update pipeline)
            │                         │                          │
            └─────────────────── scene-graph ────────────────────┘
                                      │
                    spatial-index (k-d tree, fork of kiddo)

scene-graph is the core library, published as yggdrasil-3d: layers, nodes, edges, bounds, the Observer view frustum, and every query. It is pure Rust. A SceneGraph serializes with serde, so a graph can be written to JSON and opened in the visualizer.

spatial-index backs the optional position indexes. It is a vendored fork of kiddo whose k-d tree picks each split axis from the spread of the points in the bucket instead of cycling axes with tree depth. Upstream refuses an insert when a full leaf's points all share one value on the cycled axis, and voxel-quantized indoor scans put thousands of points on one plane. spatial-index/README.md records the provenance and every deviation.

engine is the runtime that will own conflict resolution and lazy evaluation of updates; today it queues incoming subgraphs and merges them in order on read. python-binding exposes the library to Python, and viz is an interactive Bevy viewer.

Crate What it is
scene-graph Core data structure and queries; the yggdrasil-3d crate
spatial-index k-d tree with an adaptive split policy (kiddo fork); the yggdrasil-3d-spatial-index crate
engine Update pipeline for merging agents' subgraphs (early)
python-binding PyO3 bindings, packaged as yggdrasil-3d and imported as yggdrasil
viz Bevy visualizer: layer toggles, node inspection, queries
bench Benchmark harness, spatial-index against upstream kiddo
docs The Yggdrasil Book (mdBook)

The book also plans a distributed service for edge deployments and adapters such as ROS 2; neither is in this repository yet.


Performance

Positional queries are only as fast as the index behind them, and an index is only as cheap as the updates it absorbs. Yggdrasil makes that trade explicit and per-layer:

  • Indexing is opt-in. new_indexed_layer and new_indexed_node keep a k-d tree current on every coordinate change; plain layers and nodes answer the same queries without one.
  • Split static from dynamic. Keep objects that rarely move in their own indexed layer, so only the dynamic layer's index churns.
  • Bounds are nearly free. A new coordinate almost always falls inside its parent's box already, so bounding-box updates rarely propagate.

A Note On Performance covers the trade-offs in depth. bench/ measures spatial-index against upstream kiddo in one binary on identical inputs; bench/BASELINE.md documents the methodology and noise floor.


Integrations

Python

cd python-binding
uv sync                              # creates .venv with maturin
uv run maturin develop --release     # builds the extension into it
import yggdrasil as ygg

sg = ygg.SceneGraph()
points = sg.new_layer().lid
objects = sg.new_layer().lid
sg.layer(objects).add_child(points)

car = sg.layer(objects).push_node(sg.new_node([ygg.Feature("type", "car")]))
for x in (0.0, 1.0, 2.0):
    point = sg.layer(points).push_node(sg.new_coordinates(x, 0.0, 0.0, []))
    sg.nest(point, car)

node, dist = sg.nearest_nodes((0.9, 0.0, 0.0), ygg.PosQueryCount.Count(2))[0]

The module mirrors the Rust API, and ships type stubs in yggdrasil.pyi for editor completion.

Visualizer

cargo run --release -p viz                     # built-in 4-layer demo scene
cargo run --release -p viz -- --demo-multi     # same scene, one multi-coordinate node per object
cargo run --release -p viz -- scene.json       # your own graph, saved with serde_json

Toggle layers, bounding boxes and nesting edges, hover a node to inspect its features, and run queries from the side panel with the results highlighted in the scene.


Install

Rust: the crate is yggdrasil-3d on crates.io (yggdrasil there is an unrelated project); its library is named yggdrasil.

cargo add yggdrasil-3d
use yggdrasil::SceneGraph;

Python: the package is yggdrasil-3d on PyPI; it imports as yggdrasil. Wheels cover CPython 3.8+ on Linux, macOS and Windows (x86_64 and arm64); elsewhere pip builds the sdist, which needs a Rust toolchain.

pip install yggdrasil-3d

To build the bindings from source instead, see Python.

From source:

cargo build --release --workspace
Platform notes
  • Rust: stable, edition 2024. The vendored spatial-index needs 1.89 or newer.

  • Linux and viz: Bevy needs system libraries. On Debian or Ubuntu:

    sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
    

    viz enables Bevy's Wayland backend alongside X11.

  • Python: 3.8 or newer, with maturin 1.10 or newer.

  • Docker: the Dockerfile builds an Ubuntu 24.04 image with Rust.


API at a glance

Every call below is on SceneGraph; most also run on a single layer (sg.layer(id)?.nearest_nodes(...)) and exist under the same names in Python.

Build the graph

sg.new_layer()                          // allocate a layer; new_indexed_layer() also indexes it
sg.layer_mut(parent)?.add_child(child)? // arrange layers into a DAG
sg.new_node(features)                   // a semantic node
sg.new_coordinates(x, y, z, features)   // a node with a position
sg.new_indexed_node(features)           // a node that indexes the coordinates in its subtree
layer.push_node(node)?                  // insert it; returns its NodeId
sg.nest(child).under(parent)?           // parent–child link across layers
sg.detach(child).from(parent)?          // undo it
layer.add_edge(src, dst, "holding")?    // labelled edge within a layer
sg.del_node(id)?                        // remove a node

Retrieve

sg.node(id)?                            // node_mut(id)? for mutable access
sg.nodes_matching(&[&feature])          // nodes with these features, per layer
sg.nodes_having(&["type"])              // nodes with these keys, per layer
sg.edges_matching("holding")            // edges by label, per layer
sg.edges_from(id)                       // edges_to(id) for the reverse

Spatial

sg.nearest_nodes(&coord, PosQueryCount::Count(5))
sg.nodes_within(&coord, radius, PosQueryCount::All)
sg.nearest_in_subtree(&coord, root, PosQueryCount::Count(5))?
sg.visible_subgraph(&observer, root)?   // what a camera sees, as a new SceneGraph
sg.visible_in_subtree(&observer, root)  // the same, as node ids

Graph

sg.subgraph(root)?                      // everything under a node, as its own SceneGraph
sg.merge(subgraph)?                     // fold an agent's updated subgraph back in

Workspace

cargo test --workspace                  # every crate's tests
cargo doc -p yggdrasil-3d --open        # API reference
mdbook serve docs --open                # the book, live-reloading
cargo run --release -p bench            # spatial-index against upstream kiddo

Citation

If you use Yggdrasil in your research, please cite the paper, Yggdrasil: a Layer-First 3D Scene Graph for Real-Time Querying:

@misc{akhavan2026yggdrasillayerfirst3dscene,
  title         = {Yggdrasil: a Layer-First 3D Scene Graph for Real-Time Querying},
  author        = {Arshia Akhavan and Ermanno Bartoli and Afnan Algharbi and Alireza Hoseinpur and Iolanda Leite and Bryan Donyanavard},
  year          = {2026},
  eprint        = {2609.38640},
  archivePrefix = {arXiv},
  primaryClass  = {cs.RO},
  url           = {https://arxiv.org/abs/2609.38640},
}

The Cite this repository button in the GitHub sidebar gives the same citation in APA and BibTeX, from CITATION.cff.


Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for local setup and conventions, CODE_OF_CONDUCT.md for community standards, and SECURITY.md to report a vulnerability.

Paper · Book · Issues · Contributing

Licensed under Apache 2.0; spatial-index/ keeps kiddo's MIT OR Apache-2.0.
⭐ Star the repo if Yggdrasil is useful to you.

Metadata

Release files for yggdrasil-3d 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yggdrasil-3d 0.1.1
File Size Uploaded Provenance Actions
yggdrasil_3d-0.1.1.tar.gz 479.8 kB With provenance Details for yggdrasil_3d-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for yggdrasil-3d 0.1.1
File Actions
yggdrasil_3d-0.1.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for yggdrasil_3d-0.1.1-cp38-abi3-win_amd64.whl
yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details for yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl
yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details for yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl
yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
yggdrasil_3d-0.1.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for yggdrasil_3d-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
yggdrasil_3d-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for yggdrasil_3d-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 4.4 MB

Release files / yggdrasil_3d-0.1.1.tar.gz

Download URL yggdrasil_3d-0.1.1.tar.gz
Size 479.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6830b91755c767529a2e816ad45c4789dc31c3778964089bcf433ecbbff0a63e
BLAKE2b-256 checksum
How to use checksums
666220bb06946b05f98c9bdce452615f478860358a27d5d4700ab9a40597454f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-win_amd64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-win_amd64.whl
Size 374.9 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5e1816e14942de988c00134819df6e32d28114db532afb9a07796c916e2af311
BLAKE2b-256 checksum
How to use checksums
0ede67c0c0714cbfc462f032f0dde9678ecf71387066d4c7019cc07017fba2f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl
Size 754.4 kB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
cde7ed49749117546712f07a864f37e8cd14e7ee0a7b1299de34df6b01aeed61
BLAKE2b-256 checksum
How to use checksums
32cce7d3fb4321c2d8505bd5c0c62228b9e4f21fd54fc46022ceeabc17794bb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl
Size 715.8 kB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
01d4a27d5b7abaf2f0d30aeafc55dfd8b010fce247ad6b0b8aeca8b42a8841d5
BLAKE2b-256 checksum
How to use checksums
433724b183b5025bad2ebf0e020091de5deb20d3d6773cbcca61fad216fcf357
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 542.0 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b408c08d82a5fcdd0ab7cc69d0c554394ba636b3ab405969369c45d0d5a4908c
BLAKE2b-256 checksum
How to use checksums
a727ec2fb02bf1fe113b4be726cba659b077c04c7511de4d02bfaa7492606987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 537.0 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
d563c5664f00b107e5bcdaa23a503a1e2270c81b0ce82a9d6505fa1fc74631a7
BLAKE2b-256 checksum
How to use checksums
86993b6e8b0dd0806af60fd787f2b3a3d2939100e3c675505a3b490618c1d1bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
Size 487.7 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
957c8829fa710508dd0d630cc28abde44eecc47b1075fdcf199c68cb70d52671
BLAKE2b-256 checksum
How to use checksums
585402331a367f3496788b396e5b627bee9a58e0efe860f84e091a92c6b51b04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / yggdrasil_3d-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL yggdrasil_3d-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 500.4 kB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
fe5778956d03f2f210da7a2f215c9cfb4638cbfac8826d0b2552b9d075827f1d
BLAKE2b-256 checksum
How to use checksums
2c4126df996ea1a5e1971c269c5c481736ff3fb8425020990e3588645d487832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for yggdrasil-3d 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for yggdrasil_3d-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page