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.
Paper · Book · API docs · Issues · Contributing
Try Yggdrasil
cargo add yggdrasil-3d # Rust library
pip install yggdrasil-3d # Python bindings
cargo install yggdrasil-3d-viz # 3D visualizer
The library imports as yggdrasil in both languages. Run yggdrasil-3d-viz to explore the
built-in demo scene in 3D (on Linux, install Bevy's system libraries first). The
book's walkthrough runs from a checkout:
git clone https://github.com/brdsdsu/Yggdrasil.git && cd Yggdrasil
cargo run -p yggdrasil-3d --example demo # the book's walkthrough, as one program
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; the yggdrasil-3d-viz crate |
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_layerandnew_indexed_nodekeep 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
pip install yggdrasil-3d
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. To build it from a
checkout instead, see From source.
Visualizer
cargo install yggdrasil-3d-viz
yggdrasil-3d-viz # built-in 4-layer demo scene
yggdrasil-3d-viz --demo-multi # same scene, one multi-coordinate node per object
yggdrasil-3d-viz scene.json # your own graph, saved with serde_json
yggdrasil-3d-viz scene.json --up y # a scene authored Y-up (the default is Z-up)
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
Yggdrasil is published as yggdrasil-3d on both crates.io and PyPI, and imports as
yggdrasil in both languages. (The yggdrasil names on both registries belong to unrelated
projects.) The visualizer is a separate crate, yggdrasil-3d-viz.
Rust
cargo add yggdrasil-3d
use yggdrasil::SceneGraph;
The API reference is on docs.rs.
Python
pip install yggdrasil-3d
import yggdrasil as ygg
Prebuilt wheels cover CPython 3.8 and newer on Linux (glibc and musl) and macOS, each on x86_64 and arm64, and on Windows x86_64. Anywhere else, pip compiles the source distribution, which needs a Rust toolchain.
Visualizer
cargo install yggdrasil-3d-viz
This installs the yggdrasil-3d-viz command. On Linux, Bevy needs system libraries first;
see the platform notes below.
From source
Track unreleased changes on master from Rust:
cargo add yggdrasil-3d --git https://github.com/brdsdsu/Yggdrasil
Build and install the Python bindings from a checkout (pip fetches maturin itself):
git clone https://github.com/brdsdsu/Yggdrasil.git && cd Yggdrasil
pip install ./python-binding
When working on the bindings, rebuild them in place with uv instead:
cd python-binding
uv sync # creates .venv with maturin
uv run maturin develop --release # rebuilds the extension into it
Run the visualizer from a checkout:
cargo run --release -p yggdrasil-3d-viz # built-in demo scene
cargo run --release -p yggdrasil-3d-viz -- scene.json # flags go after --
Build everything, including the visualizer, the engine and the benchmarks:
cargo build --release --workspace
Platform notes
-
Rust: stable, 1.89 or newer (edition 2024; the vendored
spatial-indexsets the floor). This applies to the crates.io package too. -
Linux and the visualizer: Bevy needs system libraries, both for
cargo install yggdrasil-3d-vizand for building from source. On Debian or Ubuntu:sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
The visualizer enables Bevy's Wayland backend alongside X11.
-
Python: 3.8 or newer. Building from source also needs maturin 1.10 or newer, which
pip installanduv syncfetch on their own. -
Docker: the
Dockerfilebuilds 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. The full
reference is on docs.rs.
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 · API docs · 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yggdrasil_3d-0.1.2.tar.gz | 481.6 kB | With provenance | Details for yggdrasil_3d-0.1.2.tar.gz |
Built distributions (wheels)
Total release size: 4.4 MB
Release files / yggdrasil_3d-0.1.2.tar.gz
| Download URL | yggdrasil_3d-0.1.2.tar.gz |
|---|---|
| Size | 481.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1de9c23a1e2f4320fca795df91d3a2324d2889a7caab7672e7e2c1f3fa741a2
|
|
BLAKE2b-256 checksum How to use checksums |
57370405f310d603d93a3c1e4299602ce78b18f35faa42e0414f2c48381ea310
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-win_amd64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 375.4 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
248a66ca0eedd9211f063b90f672e478f93f9246f5a549c5c8b1d8fbcedf04ed
|
|
BLAKE2b-256 checksum How to use checksums |
2110818b7cc1541b9d521126f998971400f7a504eb3f7735b2c2720548050792
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 754.6 kB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7e706f39ba956057fdae5cc0d60390e4d700bba65f389843585727f509be13df
|
|
BLAKE2b-256 checksum How to use checksums |
8c99e64527f6be3d6091650a7fa4a0a35cc0332e0b6cf51ba9ac33acf2b605c7
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-musllinux_1_2_aarch64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 716.9 kB |
| Tags | CPython 3.8 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b3dda98584767c9011d431883f63b6c442fb84dbd52b524bcf48e685facaf689
|
|
BLAKE2b-256 checksum How to use checksums |
fad993afc0683c2f665cd14e9f76accc7e78c602131ae3a1bcc4f00b08c06ad8
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 542.6 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f46b599956a5666303ab7ce70c12fc80089dd964f106ab43af7e82583980eeb2
|
|
BLAKE2b-256 checksum How to use checksums |
0e26433b2f407ce08d8f0908cced3e262127ce22013124ee36558fc7039b44f4
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 537.5 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
01bbf0e7ceed7967b05b91be65cde3cac96831e411ce853d597a30285be0596b
|
|
BLAKE2b-256 checksum How to use checksums |
f6da30942f41c0842afb5d9c9d9f8dfa8c94f321fda76057b37add1cbdbbf6d1
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 488.2 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fa7f5b3122cfa26ee244265970a79a4e21aa5347c145228c89c804ec37e65e80
|
|
BLAKE2b-256 checksum How to use checksums |
a693f49f21fb92ec5fa1b6916b1749286e8f1ccf9394e28d22bba30f82f2a214
|
| 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 logRelease files / yggdrasil_3d-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | yggdrasil_3d-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 500.9 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
124ddd05c49da3aef9f1560ab4ffcd362dcabb6d2e61039965cbc7335e163419
|
|
BLAKE2b-256 checksum How to use checksums |
5276c7047e324d5bf1bab9b27d720b837148c8550511ab42076b8b347544859c
|
| 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 logSecurity for yggdrasil-3d 0.1.2
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.
Attestation for yggdrasil_3d-0.1.2.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 logA 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.