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 ;
use NodePoint;
use Vec3;
let bounds = new;
let mut octree = new;
octree.insert;
octree.insert;
octree.insert;
let nearby = octree.query_sphere;
assert_eq!;
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 ;
let nodes = vec!;
let ctx = TraversalContext4D ;
let path = astar_find_path_4d.unwrap;
assert_eq!;
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 ;
let file = create?;
save_graph4d?;
let file = open?;
let loaded = load_graph4d?;
Installation
[]
= "0.3"
For local development with Magellan:
= { = "../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:
Each demo can also export a JSON result for repeatable checks or reports:
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
License
GPL-3.0-only. See LICENSE.