setzer22 / egui_node_graph

Build your node graph applications in Rust, using egui
MIT License
732 stars 137 forks source link

Add topological iterator to Graph class #100

Open LvanArkel opened 1 year ago

LvanArkel commented 1 year ago

Iterating through all nodes in a graph does currently not ensure that all inputs of a node have been generated. To simplify the generation of all values in a graph, an iterator that provides a topological ordering could be created.

kamirr commented 1 year ago

You can use an existing solution for topological sorting, such as topological-sort.

I don’t think egui_node_graph can do much better than this, honestly.

edit: also, this crate allows for loops (although not without intermediate nodes), which means the such iterator can't be implemented in the general case.