Skip to main content

Crate facett_graphview

Crate facett_graphview 

Source
Expand description

facett-graphview — a domain-agnostic, scalable 2D graph render engine, vello-backed, that runtime-selects its backend by hardware: vello (GPU/wgpu compute) when a usable GPU exists, vello_cpu (multithreaded SIMD) as the no-GPU fallback. The eventual single home for every graph surface — nornir’s arch/dep/release dashboards, korp, graph-DB browsing — aiming to beat Graphviz on interactivity + scale.

§The shared API (a future drop-in for nornir’s draw_graph)

The model — GraphModel (nodes id/label/pos/fill/stroke + edges from/to/color/dashed/label) and the caller-supplied Decorations overlay (per-node ring/badge + emphasis edges) — mirrors nornir’s src/viz/graph_render.rs SHARED API exactly, so that egui routine can swap its painter for this engine without changing its callers. Decorations stay caller-supplied and domain-agnostic: facett never learns what a “release gate” is.

§Backends (vello is NOT GPU-only)

Backend {GpuVello, CpuVello}; decide turns a GpuProbe into a pick (probe → choose, mirroring nornir’s embedder runtime-select). The CPU path (cpu::render) is the proven reference — vello_cpu already ships transitively inside epaint 0.34, so it always builds here. The GPU path is a real, version-aligned seam (vello 0.9 ↔ wgpu 29 ↔ egui-wgpu 0.34), wired behind the gpu cargo feature; see [gpu].

§Render entry point

render_to_rgba dispatches on the chosen Backend and returns straight RGBA8 pixels (PNG / egui-texture ready). Today both backends route through the CPU rasterizer (the GPU readback path is the #17 follow-up); the dispatch seam is in place.

§What is STUBBED (documented, not built — see .nornir/design.md)

LOD / viewport-culling, clustering / aggregation, edge-bundling, streaming layout, and the data-source adapters (nornir dep graph / FalkorDB / pipeline). Clear TODOs live at each seam.

Re-exports§

pub use backend::probe_from_env;
pub use clip::GraphClipReport;
pub use clip::WidgetRect;
pub use clip::pick;
pub use clip::render_graph_clipped;
pub use cpu::Rendered;
pub use cpu::render as render_cpu;
pub use decorated_view::DecoratedGraphView;
pub use decorated_view::downstream_of;
pub use depgraph_layout::DepEdge;
pub use depgraph_layout::DepGraphLayout;
pub use depgraph_layout::EdgeClass;
pub use depgraph_layout::LaidEdge;
pub use depgraph_layout::LaidNode;
pub use gpu_layout::relax_cpu;
pub use gpu_layout::step_cpu;
pub use gpu_layout::GraphCsr;
pub use gpu_layout::LayoutParams;
pub use gpu_layout::LayoutState;
pub use fdeb::bundle;
pub use fdeb::occupancy;
pub use fdeb::BundleParams;
pub use fdeb::BundledEdge;
pub use community::fracture_t;
pub use community::fractured_positions;
pub use community::louvain;
pub use community::meta_graph;
pub use community::visible_count;
pub use community::Communities;
pub use community::MetaGraph;
pub use community::MetaNode;
pub use l0::render_to_rgba_l0;
pub use l0::lower as lower_to_l0;
pub use metro::MetroBranch;
pub use metro::MetroLine;
pub use metro::MetroMap;
pub use metro::MetroStation;
pub use metro::MetroView;
pub use metro::StationKind;
pub use model::BOX_H;
pub use model::BOX_W;
pub use model::Camera;
pub use model::Color;
pub use model::Decorations;
pub use model::GraphEdge;
pub use model::GraphModel;
pub use model::GraphNode;
pub use model::NodeDecoration;
pub use model::Pos;

Modules§

analysis
The pure-algorithm graph analysis toolbox (centrality / community / pathfinding / cycles / components / k-core / similarity) — the compute core of the graph-DB IDE. Index-based (n, edges); no egui, no GPU. Graph analysis — the pure-algorithm core of the graph-DB IDE (V.G / G.V()).
backend
Runtime backend selection — re-pointed to the L0 kernel (facett_core::render::backend) as of CONS-CORE Phase C. The policy (probe the hardware, then choose) now lives once in facett-core so the map skins and this graph engine decide identically; graphview re-exports the types here for back-compat, so every existing facett_graphview::{Backend, GpuProbe, decide} import (the benches, the example, nornir’s draw_graph) keeps resolving with zero source change.
clip
GRAPH-CLIP-TEST — the start→pixel clip discipline for the graph renderer, the graph twin of facett-map3d’s shade_faces / clip_poly_to_rect scissor.
community
Topological semantic zoom — community detection → meta-nodes → fracture (#3).
cpu
The CPU rasterizer (vello_cpu) — the reference render path. Builds a vello_cpu scene from a GraphModel + Decorations under a Camera and rasterizes it to a straight-RGBA8 pixel buffer (ready for a PNG or an egui texture). vello_cpu is multithreaded-SIMD software rendering: the proof that “vello” is not GPU-only.
decorated_view
DecoratedGraphView — the egui Facet that paints a GraphModel under a caller-supplied Decorations overlay (per-node status rings + corner badges, plus emphasis edges drawn on top), with pan/drag + scroll-zoom and click-to-select (lighting the clicked node’s downstream subtree). It is the egui twin of nornir’s src/viz/graph_render.rs::draw_graph — the same decorations layer the existing facett-graphview render model lacked a view for (the CPU/GPU rasterizer renders to RGBA; this is the interactive egui pane). Domain-agnostic: facett never learns what a “release gate” is — rings, badges, and cut edges are opaque Decorations.
depgraph_layout
Pure (no-egui) dependency-graph layout + edge classification — a re-home of nornir’s src/viz/depgraph_layout.rs. Domain-agnostic: instead of nornir’s CrossRepoEdge it takes a generic DepEdge (from/to + a via label list), so any host (nornir’s dep graph, a package graph, a graph- DB browse) lays out the same way.
fdeb
Force-Directed Edge Bundling (FDEB) — the answer to the hairball curse (#2).
gpu_layout
GPU-compute force-directed layout — the elite engine’s must-land core.
l0
The L0 kernel adoption (CONS-CORE Phase C, step 1) — route a graph’s nodes and straight edges through the shared facett_core::render Canvas seam instead of graphview’s bespoke vello_cpu scene.
metro
Metro / subway-line view — render a test-coverage chain as a transit line. Each line runs from a UI button (the START), through the functions on the chain that emit a functional_status (the STATIONS), past the pass-through functions that carry no emitter (thin ticks, “ridden through”), into the gRPC handler (END) and finally the warehouse table (TERMINUS).
model
The domain-agnostic graph model — the same shape nornir’s src/viz/graph_render.rs::draw_graph accepts, so this engine is a future drop-in for that egui routine. Nodes are laid out in world space by the caller (each domain owns its own layout/columns); edges reference nodes by id. Decorations is the caller-supplied overlay — facett mustn’t know what a “release gate” is, so rings/badges/emphasis-edges are opaque here.

Structs§

GpuProbe
What a hardware probe found. The caller fills this (e.g. from a wgpu adapter enumeration, an env override, or a forced-CPU test flag); the policy — turning a probe into a pick — lives in decide so every surface decides identically.

Enums§

Backend
The chosen rasterizer.

Functions§

decide
THE picker: turn a GpuProbe into a Backend. GPU when usable and not forced off and the wgpu feature is compiled in; CPU otherwise. Keeping this pure (probe in, enum out) makes the policy trivially testable.
render_to_rgba
Render model (decorated, under camera) to a w × h straight-RGBA8 frame, dispatching on the runtime-chosen backend. The one call a host makes after decide.