3D spatial + 4D temporal graph database — Python bindings to geographdb-core
Project description
geographdb-core
3D spatial indexing and graph-storage primitives for CFG and graph analysis.
This crate provides octree indexing, Morton ordering, sectioned storage, CFG block storage, and graph algorithms for tools that model control-flow and graph structure geometrically.
Features
- Octree spatial indexing for 3D points and bounding boxes
- Morton code ordering for cache-friendly spatial locality
- Sectioned storage for graph, symbol, and CFG records
- CFG-oriented storage and query helpers
- Graph algorithms including A*, SCC, dominance, loops, slicing, and topological ordering
- 4D traversal primitives that combine graph topology, 3D spatial filters, and temporal validity windows
- Small Cypher-like 4D query layer for pattern, routing, and impact queries
Code-Intelligence Use Case
Magellan stores control-flow blocks in 3D space:
- X = structural or dominance depth
- Y = loop nesting level
- Z = function or path grouping dimension
Tools can then query control-flow structure using geometric locality.
use geographdb_core::spatial::{BoundingBox, Octree};
use geographdb_core::storage::NodePoint;
use glam::Vec3;
let bounds = BoundingBox::new(
Vec3::new(0.0, 0.0, 0.0),
Vec3::new(100.0, 100.0, 100.0),
);
let mut octree = Octree::new(bounds);
octree.insert(NodePoint { id: 1, x: 0.0, y: 0.0, z: 42.0 });
octree.insert(NodePoint { id: 2, x: 1.0, y: 0.0, z: 42.0 });
octree.insert(NodePoint { id: 3, x: 2.0, y: 1.0, z: 42.0 });
let nearby = octree.query_sphere(Vec3::new(1.0, 0.0, 42.0), 2.0);
assert_eq!(nearby.len(), 3);
4D Graph Traversal
Use the 4D algorithm API when a graph edge or node should only participate in a query inside a spatial region and temporal window.
use geographdb_core::{
astar_find_path_4d, GraphNode4D, TemporalEdge, TemporalWindow, TraversalContext4D,
};
let nodes = vec![
GraphNode4D {
id: 1,
x: 0.0,
y: 0.0,
z: 42.0,
begin_ts: 0,
end_ts: 100,
properties: Default::default(),
successors: vec![TemporalEdge {
dst: 2,
weight: 1.0,
begin_ts: 0,
end_ts: 100,
}],
},
GraphNode4D {
id: 2,
x: 1.0,
y: 0.0,
z: 42.0,
begin_ts: 0,
end_ts: 100,
properties: Default::default(),
successors: vec![],
},
];
let ctx = TraversalContext4D {
time_window: Some(TemporalWindow { start: 10, end: 20 }),
spatial_region: None,
graph_weight: 1.0,
spatial_weight: 0.5,
temporal_weight: 0.0,
};
let path = astar_find_path_4d(&nodes, 1, 2, &ctx).unwrap();
assert_eq!(path.node_ids, vec![1, 2]);
GraphNode4D::properties is a JSON metadata map. The 4D Cypher-like layer can
project those values directly with queries such as
MATCH (a)-[:CONNECTS]->(b) RETURN a.name, b.name.
Persistence
save_graph4d and load_graph4d round-trip a full 4D graph through the
GraphStorageManager, persisting nodes, edges, the dual octree spatial index,
and typed node properties to a .geo archive.
use geographdb_core::{save_graph4d, load_graph4d};
let file = std::fs::File::create("graph.geo")?;
save_graph4d(file, &nodes)?;
let file = std::fs::File::open("graph.geo")?;
let loaded = load_graph4d(file)?;
Installation
[dependencies]
geographdb-core = "0.3"
For local development with Magellan:
geographdb-core = { path = "../geographdb-core" }
Runnable 4D Demos
The crate includes runnable 4D graph demos: temporal dependencies, constrained impact analysis, route adaptation, time-respecting delivery, signal propagation, dynamic bottleneck resilience, orbit constellation, metamaterial design, and protein conformation.
Together they show standard graph questions upgraded with temporal validity and 3D spatial context:
cargo run --example demo_4d_dependency_timeline
cargo run --example demo_4d_cypher_bottlenecks
cargo run --example demo_4d_cypher_impact_radius
cargo run --example demo_4d_cypher_match_filters
cargo run --example demo_4d_cypher_queries
cargo run --example demo_4d_cypher_disaster_response
cargo run --example demo_4d_cypher_signal_propagation
cargo run --example demo_4d_cypher_temporal_route
cargo run --example demo_4d_impact_radius
cargo run --example demo_4d_route_planning
cargo run --example demo_4d_signal_propagation
cargo run --example demo_4d_temporal_bottlenecks
cargo run --example demo_4d_temporal_delivery
cargo run --example demo_4d_orbit_constellation
cargo run --example demo_4d_metamaterial_design
cargo run --example demo_4d_protein_conformation
Each demo can also export a JSON result for repeatable checks or reports:
cargo run --quiet --example demo_4d_dependency_timeline -- --json > dependency-timeline.json
cargo run --quiet --example demo_4d_cypher_bottlenecks -- --json > cypher-bottlenecks.json
cargo run --quiet --example demo_4d_cypher_impact_radius -- --json > cypher-impact-radius.json
cargo run --quiet --example demo_4d_cypher_match_filters -- --json > cypher-match-filters.json
cargo run --quiet --example demo_4d_cypher_queries -- --json > cypher-queries.json
cargo run --quiet --example demo_4d_cypher_disaster_response -- --json > cypher-disaster-response.json
cargo run --quiet --example demo_4d_cypher_signal_propagation -- --json > cypher-signal-propagation.json
cargo run --quiet --example demo_4d_cypher_temporal_route -- --json > cypher-temporal-route.json
cargo run --quiet --example demo_4d_impact_radius -- --json > impact-radius.json
cargo run --quiet --example demo_4d_route_planning -- --json > route-planning.json
cargo run --quiet --example demo_4d_signal_propagation -- --json > signal-propagation.json
cargo run --quiet --example demo_4d_temporal_bottlenecks -- --json > temporal-bottlenecks.json
cargo run --quiet --example demo_4d_temporal_delivery -- --json > temporal-delivery.json
cargo run --quiet --example demo_4d_orbit_constellation -- --json > orbit-constellation.json
cargo run --quiet --example demo_4d_metamaterial_design -- --json > metamaterial-design.json
cargo run --quiet --example demo_4d_protein_conformation -- --json > protein-conformation.json
Sample outputs are stored under examples/results/.
demo_4d_cypher_queriesshows a small Cypher-like layer forMATCH, property projections,WHERE time_window(...),WHERE spatial_sphere(...), andCALL db.*procedure queries.demo_4d_cypher_match_filters,demo_4d_cypher_temporal_route,demo_4d_cypher_impact_radius,demo_4d_cypher_bottlenecks, anddemo_4d_cypher_signal_propagationsplit that query layer into focused, copyable scenarios.demo_4d_dependency_timelinecompares reachability, path search, and SCCs before and after a dependency graph changes over time.demo_4d_impact_radiuscompares topology-only impact analysis with the same query constrained to a local 3D region and a current time window.demo_4d_route_planningshows A* selecting a different route when the direct corridor is no longer valid in the requested time window.demo_4d_signal_propagationshows a time-dependent Dijkstra arrival wave from one source across scheduled links.demo_4d_temporal_bottlenecksshows critical relays and links disappearing after a temporary relay creates redundancy.demo_4d_temporal_deliveryshows causal temporal routing where edge schedules determine whether the next hop is possible after arrival.
Scope
This crate contains the Rust core used for spatial CFG and graph storage. Language bindings and larger application crates are separate packages.
Public API Areas
spatial:Octree,BoundingBox, Morton encoding, and SIMD distance filtering.storage: sectioned.geostorage, sidecar path helpers, graph/CFG/symbol section adapters, WAL records, dual octree spatial indexing,GraphStorageManager, and theprop_storebinary typed-property format.cfg_store: high-level CFG block storage backed by spatial indexing.algorithms: graph algorithms for CFG analysis and path reasoning.- Persistence via
save_graph4dandload_graph4dfor full 4D graph round-trips.
Feature Flags
telemetry: enables tracing and dashmap-backed instrumentation helpers.debug-prints: enables debug instrumentation points used during local investigation.
Documentation
- API.md describes the public modules and common types.
- MANUAL.md covers local development, verification, and publishing.
- CHANGELOG.md records release changes.
Verification
cargo check
cargo test
cargo publish --dry-run
cargo package --list
License
GPL-3.0-only. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geographdb-0.3.1.tar.gz.
File metadata
- Download URL: geographdb-0.3.1.tar.gz
- Upload date:
- Size: 173.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66359cee19f654fbeafc16d8cd15c9b6f41f6b59bcfbaa2cfd037c478969028c
|
|
| MD5 |
095bd1de144858f2f3a2bf70bdfb551e
|
|
| BLAKE2b-256 |
22690a32da91b3e6db1f40c20eaf1daee695fb1b6883fa7e3ea3fc0613eeb3ec
|
Provenance
The following attestation bundles were made for geographdb-0.3.1.tar.gz:
Publisher:
publish.yml on oldnordic/geographdb-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geographdb-0.3.1.tar.gz -
Subject digest:
66359cee19f654fbeafc16d8cd15c9b6f41f6b59bcfbaa2cfd037c478969028c - Sigstore transparency entry: 1588248414
- Sigstore integration time:
-
Permalink:
oldnordic/geographdb-core@8dee69f0bc0691e7eef4b774efb4b559aea26863 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dee69f0bc0691e7eef4b774efb4b559aea26863 -
Trigger Event:
push
-
Statement type:
File details
Details for the file geographdb-0.3.1-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: geographdb-0.3.1-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 705.5 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c592c0d97f325222211a1f3774e927fb80e43693a7b773b2c0f7480e51e20c8f
|
|
| MD5 |
e887c21bb022bcc264ded3e456e88d4a
|
|
| BLAKE2b-256 |
d5d9f3c876095f273059b2ca1895a8121ced93b6f2cbe6a6e9102d1b2d91e9a7
|
Provenance
The following attestation bundles were made for geographdb-0.3.1-cp310-abi3-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on oldnordic/geographdb-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geographdb-0.3.1-cp310-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
c592c0d97f325222211a1f3774e927fb80e43693a7b773b2c0f7480e51e20c8f - Sigstore transparency entry: 1588248547
- Sigstore integration time:
-
Permalink:
oldnordic/geographdb-core@8dee69f0bc0691e7eef4b774efb4b559aea26863 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dee69f0bc0691e7eef4b774efb4b559aea26863 -
Trigger Event:
push
-
Statement type: