blitzarx1 / egui_graphs

Interactive graph visualization widget for rust powered by egui and petgraph
https://docs.rs/crate/egui_graphs
MIT License
417 stars 30 forks source link

Node ids are None when following readme #164

Closed XertroV closed 9 months ago

XertroV commented 9 months ago

The readme and examples use g.add_node(..) instead of add_node(g, ..). Or at the very least it should specify that if you update the graph later you need to need to use that helper function.

Though IDK why it isn't implemented on Graph, that would make more sense.

This isn't at all obvious is you are initializing an empty graph and building it from a live data source.

If you don't do this, you run into all kinds of issues like the .unwrap()s in fn id()s.

Might make some PRs

blitzarx1 commented 9 months ago

Thanks for noting this out.

I agree than node binding approach is bad design, and when you modify graph you need to use this helper functions all around. I will add methods for adding and removing node to the Graph api. This is discussed here #135.