bitwalker / libgraph

A graph data structure library for Elixir projects
MIT License
524 stars 75 forks source link

add support for leaf_vertices function? #68

Closed mmmries closed 1 year ago

mmmries commented 1 year ago

Hi @bitwalker, thank you for this awesome library. I have a use-case where I'm building up a dependency tree and I want to visit all of the leaf nodes first to resolve those before I bother to visit nodes that I know have unresolved dependencies.

I was thinking that I would fork this repo and open a PR that adds a Graph.leaf_vertices/1 function. I'm guessing that the implementation will look something like iterating through the in_edges keys (things that we know have a dependent) and skipping any items that also appear in the out_edges map. I think that should give me all of the leaf vertices in an efficient way?

I just wanted to check with you first if this was a desirable change to the project before I do the work to open the PR