dominikbraun / graph

A library for creating generic graph data structures and modifying, analyzing, and visualizing them.
https://graph.dominikbraun.io
Apache License 2.0
1.77k stars 95 forks source link

feat: add method that returns all vertices #167

Open dtomasi opened 5 months ago

dtomasi commented 5 months ago

Hi Dominik,

I would like to add a method to Graph and Store interface that returns all the vertices that have been added. I'm using graph to resolve dependencies and have to loop over all the vertices after all the edges have been set without error. So this would safe me from keeping an extra map or slice with vertices in my project. Let me know if you want me to change anything in this implementation.

Best, Dominik

dominikbraun commented 4 months ago

Hi Dominik (nice name!), thanks for you PR! This seems to be a quite sought-after function, I believe #149 also implements this. What's your thoughts on the differences between your two approaches, @jonbrandenburg and @dtomasi?