Expand description
Force-directed network graph component for GPUI, built on gpui-base.
NetworkGraph is a stateful view (an Entity): it owns the layout,
viewport, hover and selection state across frames. Create it with cx.new,
feed it GraphData and subscribe to NetworkGraphEvents. The host app
owns data loading, panels and menus; it answers events such as
NetworkGraphEvent::ContextMenu with its own UI.
Call init once at startup to register the keyboard bindings (arrow keys
move the selection, Enter activates, Escape clears, =/-/0 zoom and
fit, Shift-F10 opens the context menu). The graph is a tab stop.
Colors follow the gpui-base Theme unless overridden
with NetworkGraph::with_colors.
Re-exports§
pub use actions::init;
Modules§
Structs§
- Category
Info - A category present in the graph, for legends.
- Edge
- A directed relationship between two nodes. Parallel edges and self-loops are allowed.
- Force
Config - Tuning knobs, named after their d3-force counterparts.
- Graph
Colors - Colors the graph paints with. By default they are derived from the
gpui-base
Themeevery frame, so appearance changes apply immediately. - Graph
Data - A batch of nodes and edges, as returned by a query.
- Group
Info - A group (community) present in the graph.
- Network
Graph - An interactive, force-directed network graph.
- Node
- A vertex in the graph. Build with
Node::newand the builder methods. - Palette
- Category / group colors, assigned in the order they first appear.
Enums§
- ColorBy
- What node colors encode.
- Label
Mode - Which node labels are drawn.
- Network
Graph Event - Node
Sizing - How node radius (in world units) is derived when a node has no explicit size.
- Selection
- What the user has selected or is pointing at.
Type Aliases§
- Tooltip
Builder - Builds tooltip content for the hovered item;
Nonehides the tooltip.