Querying for leaf nodes using libgraph?

I’m working on a project where I need to track dependencies between several items. In some cases this working set my contain 100k or so vertices and maybe 300k edges. I’m looking for an efficient way to get just the leaf nodes so i can do the work for those nodes, then prune the graph and repeat to efficiently work my way through the graph.

Has anyone done a project along these lines? Or used libgraph or digraph to find leaf nodes efficiently?