Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement graph components and archetypes #7500

Open
wants to merge 163 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
b863aa4
feat: initial implementation of graph primitives
grtlr Sep 23, 2024
d3b22d1
WIP: try to get `egui_graphs` to work
grtlr Sep 24, 2024
b39c35a
WIP: revise data model
grtlr Sep 25, 2024
74f1aeb
WIP: improve data model by making node ids non-global
grtlr Sep 25, 2024
8102a95
WIP: fmt
grtlr Sep 25, 2024
10339c1
WIP: Basic color component working with clamping
grtlr Sep 26, 2024
6c6519b
WIP: streamline visualizer data processing
grtlr Sep 27, 2024
c2a2d4e
WIP: fix component aggregation
grtlr Sep 27, 2024
b2c9a73
WIP: build an internal `petgraph` representation
grtlr Sep 27, 2024
0f78d8b
WIP: Implement basic highlights
grtlr Sep 27, 2024
8823513
WIP: basic node drawing
grtlr Sep 27, 2024
c0900c9
WIP: fix lints
grtlr Sep 27, 2024
34032eb
WIP: try to get edges working
grtlr Sep 30, 2024
aaa8733
WIP: implement node labels
grtlr Sep 30, 2024
30ec59d
WIP: basic edge drawing working
grtlr Sep 30, 2024
36d4c8f
WIP: highlight edges
grtlr Sep 30, 2024
5c0284f
WIP: improve style
grtlr Sep 30, 2024
aeb518e
WIP: drag and drop working
grtlr Sep 30, 2024
58328fb
WIP: clean up drawing code
grtlr Sep 30, 2024
e41c0fe
WIP: add basic entity boxes
grtlr Sep 30, 2024
7558ee3
WIP: improve hierarchical labels
grtlr Oct 1, 2024
e1965bf
WIP: reduce cloning
grtlr Oct 1, 2024
d8b16c8
WIP: refactor out layout in separate pass
grtlr Oct 1, 2024
803ef60
WIP: fix lints
grtlr Oct 1, 2024
b786845
WIP: fix drawing problems
grtlr Oct 2, 2024
dff3358
WIP: refactor layout algorithm
grtlr Oct 2, 2024
f644118
WIP: fit so screen
grtlr Oct 2, 2024
ef3da62
WIP: fix bounding box extent
grtlr Oct 2, 2024
8e4c69d
WIP: debug layers
grtlr Oct 2, 2024
c50a508
WIP: More cleanup
grtlr Oct 2, 2024
eac1765
WIP: show entity path again
grtlr Oct 2, 2024
761d817
WIP: fmt
grtlr Oct 2, 2024
4aaac83
WIP: introduce `EdgeInstance`
grtlr Oct 2, 2024
95bbb99
WIP: limit scale to 1
grtlr Oct 2, 2024
ff950e0
WIP: improve node styling
grtlr Oct 7, 2024
5e1cdcb
WIP: refactor edges
grtlr Oct 7, 2024
ebf5a66
WIP: prepare for dummy nodes
grtlr Oct 7, 2024
63f9baa
WIP: basic dummy nodes working
grtlr Oct 8, 2024
44cd7d2
WIP: improve dummy nodes
grtlr Oct 8, 2024
c5104be
WIP: fix dummy nodes
grtlr Oct 8, 2024
0c5d6b9
WIP: fmt
grtlr Oct 8, 2024
8f99d6f
WIP: refactor layout
grtlr Oct 8, 2024
6465092
WIP: cleanup
grtlr Oct 8, 2024
511543d
WIP: factor out drawing of entities
grtlr Oct 8, 2024
3c3e65f
WIP: make debug information available in selection
grtlr Oct 8, 2024
0df93fd
WIP: clean up
grtlr Oct 8, 2024
d42c899
WIP: minor changes
grtlr Oct 8, 2024
002c7b0
WIP: cleanup
grtlr Oct 8, 2024
8fea1fc
WIP: fix visibility
grtlr Oct 8, 2024
80ad5b1
WIP: More cleanup
grtlr Oct 9, 2024
6463f23
WIP: moving things around
grtlr Oct 9, 2024
32b9f9c
WIP: more cleanup
grtlr Oct 9, 2024
4654d3e
WIP: forgotten
grtlr Oct 9, 2024
a1d9dc7
WIP: more fix
grtlr Oct 9, 2024
61203fb
WIP: initial implementation of directed edges
grtlr Oct 9, 2024
435a646
WIP: implement `LayoutProvider`
grtlr Oct 9, 2024
9c86e37
WIP: layout switching and convenience
grtlr Oct 10, 2024
fc40c49
WIP: fmt
grtlr Oct 10, 2024
69d225e
WIP: rerun (no pun intended :innocent:) codegen
grtlr Oct 10, 2024
58e2267
WIP: add social example and some fixes
grtlr Oct 10, 2024
8fd9263
WIP: use unreleased version of `fdg`
grtlr Oct 11, 2024
6fddce8
feat: implement `From<ShowLabels>` for `bool`
grtlr Oct 11, 2024
c64678e
WIP: better force-directed layouts and nodes as circles
grtlr Oct 11, 2024
933a712
WIP: fmt
grtlr Oct 11, 2024
25022b7
WIP: improve node rendering
grtlr Oct 11, 2024
760d8d4
WIP: make circles draggable
grtlr Oct 11, 2024
f32e299
WIP: make circle logic position independent
grtlr Oct 11, 2024
69e55fc
WIP: prepare refactor
grtlr Oct 11, 2024
db1dc1d
WIP: remove `Layout` trait
grtlr Oct 14, 2024
c96ac2e
WIP: add tooltips
grtlr Oct 14, 2024
da1c85a
WIP: static graphs
grtlr Oct 14, 2024
c73f2e5
WIP: improve hash
grtlr Oct 14, 2024
009482c
WIP: cleanup
grtlr Oct 14, 2024
adad111
WIP: fmt
grtlr Oct 14, 2024
37562a3
WIP: Basic scene refactor working
grtlr Oct 14, 2024
85ccfed
WIP: finish scene abstraction
grtlr Oct 15, 2024
8fa2c63
WIP: fix docs
grtlr Oct 15, 2024
600b812
WIP: initial implementation of `re_force`
grtlr Oct 16, 2024
e5d70f6
WIP: improve `re_force` implementation
grtlr Oct 17, 2024
898afc6
WIP: before improving `link` force
grtlr Oct 18, 2024
e60b06f
WIP: fmt
grtlr Oct 18, 2024
6c9f327
WIP: improve forces
grtlr Oct 18, 2024
8685be0
WIP: improve simulation flow
grtlr Oct 18, 2024
b919f17
WIP: improve example
grtlr Oct 18, 2024
9c7e021
WIP: start implementing quadtree
grtlr Oct 18, 2024
eb09bfb
WIP: fix cover
grtlr Oct 22, 2024
748740c
WIP: fmt
grtlr Oct 22, 2024
c2edffd
Merge branch 'main' into feat/graph-primitives
grtlr Oct 22, 2024
229e6b6
WIP: move graph view inside of Rerun
grtlr Oct 22, 2024
dda3947
WIP: fmt
grtlr Oct 22, 2024
b63f0ed
WIP: fix `Cargo.lock`
grtlr Oct 22, 2024
b4c5ce3
WIP: fix imports
grtlr Oct 22, 2024
812a5d1
WIP: implement radial layout
grtlr Oct 23, 2024
85b5963
WIP
grtlr Oct 23, 2024
fb44b7a
WIP
grtlr Oct 23, 2024
1408bad
WIP: undo data model changes
grtlr Oct 23, 2024
a40390c
WIP: implement new data model
grtlr Oct 24, 2024
49e8277
WIP: improve examples
grtlr Oct 24, 2024
3aa50ac
WIP: cleanup and feedback
grtlr Oct 24, 2024
181d6a4
WIP: fix
grtlr Oct 24, 2024
68e9435
WIP: codegen
grtlr Oct 24, 2024
111b0f5
WIP: implement `nohash_hasher::IsEnabled`
grtlr Oct 24, 2024
64c09f1
WIP: doc
grtlr Oct 24, 2024
cdae279
WIP: Remove `social` example files
grtlr Oct 24, 2024
adb3ec9
WIP: remove broken examples
grtlr Oct 24, 2024
b694ac3
WIP: Remove experimental feature flag
grtlr Oct 25, 2024
eb4ae25
WIP: Add archetypes to `gen_common_index.py`
grtlr Oct 25, 2024
c36e011
WIP: fix codegen and start working on Python example
grtlr Oct 25, 2024
b1ae62a
WIP: missing Python import
grtlr Oct 25, 2024
d524516
WIP: try to get example to run
grtlr Oct 25, 2024
558b98b
WIP: import rerun
grtlr Oct 25, 2024
f1d9f21
WIP: lints
grtlr Oct 25, 2024
2bf7079
WIP: add view icon (looking great by the way! :star-struck:)
grtlr Oct 25, 2024
59acc6b
WIP: include example
grtlr Oct 25, 2024
10cf7f0
WIP: initial Python example
grtlr Oct 25, 2024
5613a07
WIP: finish first Python example
grtlr Oct 25, 2024
d9d4a02
WIP: doc
grtlr Oct 25, 2024
729682c
WIP: remove dead code
grtlr Oct 25, 2024
e04b6e5
WIP: fit to screen
grtlr Oct 25, 2024
2fa2815
Merge branch 'main' into feat/graph-primitives
grtlr Oct 25, 2024
007e8d1
WIP: fix `pixi.lock`
grtlr Oct 25, 2024
f3ff5f6
WIP: Change to `Utf8Pair`
grtlr Oct 28, 2024
59049fe
WIP: `attr.doc` and docstrings
grtlr Oct 28, 2024
b3d7b4c
Register GraphType component edit ui
abey79 Oct 28, 2024
9ef47be
WIP: `pixi run codegen`
grtlr Oct 28, 2024
0674ef0
WIP: prevent nodes from being dragged
grtlr Oct 28, 2024
81d556d
WIP: basic blueprint support
grtlr Oct 28, 2024
50a11a9
WIP: fix Python example
grtlr Oct 28, 2024
24b3ed7
WIP: try to provide types
grtlr Oct 28, 2024
82f190c
WIP: more feedback
grtlr Oct 29, 2024
ec64a20
WIP: cleanup
grtlr Oct 29, 2024
36f6670
WIP: add `binary_tree` example to Rust
grtlr Oct 29, 2024
9140ee6
Merge branch 'main' into fork/grtlr/feat/graph-primitives
abey79 Oct 29, 2024
5375384
WIP: fix `machete` warnings
grtlr Oct 29, 2024
9f6d989
WIP: use packages from the workspace
grtlr Oct 29, 2024
a80192c
WIP: remove `serde` from codegen
grtlr Oct 29, 2024
954844c
WIP: `clippy`
grtlr Oct 29, 2024
3b7608e
WIP: feedback and removal of lifetimes
grtlr Oct 29, 2024
b636bc3
WIP: refactor per entity drawing
grtlr Oct 29, 2024
ead179f
WIP: Minor improvements
grtlr Oct 30, 2024
1023394
WIP: use mono component
grtlr Oct 30, 2024
bc4580d
WIP: add entity selections
grtlr Oct 30, 2024
c790ef4
WIP: handle implicit nodes
grtlr Oct 30, 2024
d1d144a
WIP: remove unneeded `error`
grtlr Oct 30, 2024
08eff6e
WIP: add Python and Rust snippets
grtlr Oct 30, 2024
91e9385
WIP: still broken! `C++` snippet
grtlr Oct 30, 2024
ebcbe4c
WIP: C++ examples with warnings
grtlr Oct 30, 2024
9b55b72
Merge branch 'main' into feat/graph-primitives
grtlr Nov 4, 2024
539ad0a
WIP: rerun :wink: codegen
grtlr Nov 4, 2024
0284625
WIP: fmt
grtlr Nov 4, 2024
c7de2bf
WIP: more lints
grtlr Nov 4, 2024
d295b43
WIP: remove unneeded dependencies
grtlr Nov 4, 2024
29e4a53
WIP: missing entry in `manifest.toml`
grtlr Nov 4, 2024
47c20a5
WIP: improve Python example
grtlr Nov 4, 2024
ebf8fa2
WIP: more lints
grtlr Nov 4, 2024
89232ad
WIP: format C++ snippets
grtlr Nov 4, 2024
83cb218
WIP: improve C++ example
grtlr Nov 4, 2024
636a7c5
WIP: drive-by fix of `tensor_dimension_ext.cpp`
grtlr Nov 4, 2024
5a7cb20
WIP: typo
grtlr Nov 4, 2024
a242daa
WIP: fix doc comment
grtlr Nov 4, 2024
9d14402
WIP: fix `entity`
grtlr Nov 4, 2024
9585b16
WIP: reset layout after every frame
grtlr Nov 5, 2024
c100d50
WIP: fix view init
grtlr Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Update instructions:
| re_space_view | Types & utilities for defining Space View classes and communicating with the Viewport. |
| re_space_view_bar_chart | A Space View that shows a single bar chart. |
| re_space_view_dataframe | A Space View that shows the data contained in entities in a table. |
| re_space_view_graph | A Space View that shows a graph (node-link diagram). |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: update the crate diagram

| re_space_view_spatial | Space Views that show entities in a 2D or 3D spatial relationship. |
| re_space_view_tensor | A Space View dedicated to visualizing tensors with arbitrary dimensionality. |
| re_space_view_text_document | A simple Space View that shows a single text box. |
Expand Down
37 changes: 37 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3851,6 +3851,19 @@ dependencies = [
"static_assertions",
]

[[package]]
name = "node_link_graph"
version = "0.19.0-alpha.1+dev"
dependencies = [
"anyhow",
"clap",
"glam",
"itertools 0.13.0",
"rerun",
"strum",
"strum_macros",
]

[[package]]
name = "nohash-hasher"
version = "0.2.0"
Expand Down Expand Up @@ -5869,6 +5882,29 @@ dependencies = [
"thiserror",
]

[[package]]
name = "re_space_view_graph"
version = "0.20.0-alpha.1+dev"
dependencies = [
"ahash",
"bytemuck",
"egui",
"nohash-hasher",
"re_chunk",
"re_format",
"re_log",
"re_log_types",
"re_query",
"re_renderer",
"re_space_view",
"re_tracing",
"re_types",
"re_ui",
"re_viewer_context",
"re_viewport_blueprint",
"thiserror",
]

[[package]]
name = "re_space_view_spatial"
version = "0.20.0-alpha.1+dev"
Expand Down Expand Up @@ -6238,6 +6274,7 @@ dependencies = [
"re_smart_channel",
"re_space_view_bar_chart",
"re_space_view_dataframe",
"re_space_view_graph",
"re_space_view_spatial",
"re_space_view_tensor",
"re_space_view_text_document",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ re_selection_panel = { path = "crates/viewer/re_selection_panel", version = "=0.
re_space_view = { path = "crates/viewer/re_space_view", version = "=0.20.0-alpha.1", default-features = false }
re_space_view_bar_chart = { path = "crates/viewer/re_space_view_bar_chart", version = "=0.20.0-alpha.1", default-features = false }
re_space_view_dataframe = { path = "crates/viewer/re_space_view_dataframe", version = "=0.20.0-alpha.1", default-features = false }
re_space_view_graph = { path = "crates/viewer/re_space_view_graph", version = "=0.20.0-alpha.1", default-features = false }
re_space_view_spatial = { path = "crates/viewer/re_space_view_spatial", version = "=0.20.0-alpha.1", default-features = false }
re_space_view_tensor = { path = "crates/viewer/re_space_view_tensor", version = "=0.20.0-alpha.1", default-features = false }
re_space_view_text_document = { path = "crates/viewer/re_space_view_text_document", version = "=0.20.0-alpha.1", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace rerun.archetypes;

// ---

/// A list of edges in a graph.
///
/// By default, edges are undirected.
table GraphEdges (
"attr.rust.derive": "PartialEq, Eq",
"attr.docs.category": "Graph",
"attr.docs.view_types": "Graph View"
) {
grtlr marked this conversation as resolved.
Show resolved Hide resolved
// --- Required ---

/// A list of node IDs.
edges: [rerun.components.GraphEdge] ("attr.rerun.component_required", order: 1000);


// --- Recommended ---

/// Specifies if the graph is directed or undirected.
grtlr marked this conversation as resolved.
Show resolved Hide resolved
graph_type: rerun.components.GraphType ("attr.rerun.component_recommended", nullable, order: 2000);

}
29 changes: 29 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes/graph_nodes.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace rerun.archetypes;

// ---

/// A list of nodes in a graph with optional labels, colors, etc.
table GraphNodes (
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Graph",
"attr.docs.view_types": "Graph View"
) {
// --- Required ---

/// A list of node IDs.
node_ids: [rerun.components.GraphNode] ("attr.rerun.component_required", order: 1000);

// --- Optional ---

/// Optional center positions of the nodes.
positions: [rerun.components.Position2D] ("attr.rerun.component_recommended", nullable, order: 3000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random thought for the future: it might be nice to have a view property to control whether these positions should be overridden by the auto-layout, if any.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! We also could conceptualize this even a bit more. In my current implementation the user can drag individual nodes, and in the future the auto-layout should dynamically adapt to those changes. One idea would then be to set the position of that particular node as an override. However, I'm not sure if I can override a single value in a component batch?

grtlr marked this conversation as resolved.
Show resolved Hide resolved

/// Optional colors for the boxes.
colors: [rerun.components.Color] ("attr.rerun.component_recommended", nullable, order: 3100);
grtlr marked this conversation as resolved.
Show resolved Hide resolved

/// Optional text labels for the node.
labels: [rerun.components.Text] ("attr.rerun.component_optional", nullable, order: 3200);

/// Optional choice of whether the text labels should be shown by default.
show_labels: rerun.components.ShowLabels ("attr.rerun.component_optional", nullable, order: 3250);
}
3 changes: 3 additions & 0 deletions crates/store/re_types/definitions/rerun/components.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions crates/store/re_types/definitions/rerun/components/graph_edge.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace rerun.components;

// ---

/// An edge in a graph connecting two nodes.
table GraphEdge (
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent",
"attr.rust.custom_clause":
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))'
) {
edge: rerun.datatypes.GraphEdge (order: 100);
}
15 changes: 15 additions & 0 deletions crates/store/re_types/definitions/rerun/components/graph_node.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace rerun.components;

// ---

/// A string-based ID representing a node in a graph.
table GraphNode (
"attr.python.aliases": "str",
"attr.python.array_aliases": "str, Sequence[str]",
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent",
"attr.rust.custom_clause":
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))'
) {
id: rerun.datatypes.GraphNode (order: 100);
}
19 changes: 19 additions & 0 deletions crates/store/re_types/definitions/rerun/components/graph_type.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace rerun.components;

// --

/// Specifies if a graph has directed or undirected edges.
enum GraphType: ubyte (
"attr.rust.derive": "Default, PartialEq, Eq",
"attr.rust.custom_clause":
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))'
) {
/// Invalid value. Won't show up in generated types.
Invalid = 0,

/// The graph has undirected edges.
Undirected (default),

/// The graph has directed edges.
Directed,
}
2 changes: 2 additions & 0 deletions crates/store/re_types/definitions/rerun/datatypes.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions crates/store/re_types/definitions/rerun/datatypes/graph_edge.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace rerun.datatypes;

/// An edge in a graph connecting two nodes.
table GraphEdge (
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.custom_clause":
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))'
) {
/// The id of the source node.
source: rerun.datatypes.GraphNode (order: 100);

/// The id of the target node.
target: rerun.datatypes.GraphNode (order: 200);
}
15 changes: 15 additions & 0 deletions crates/store/re_types/definitions/rerun/datatypes/graph_node.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace rerun.datatypes;

/// A string-based ID representing a node in a graph.
table GraphNode (
"attr.arrow.transparent",
"attr.python.aliases": "str",
"attr.python.array_aliases": "Sequence[str]",
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord, Hash",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct",
"attr.rust.custom_clause":
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))'
) {
id: string (order: 100);
}
2 changes: 2 additions & 0 deletions crates/store/re_types/src/archetypes/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading