mdickinson / refcycle

Support for displaying and analyzing reference graphs of Python objects.
Apache License 2.0
15 stars 1 forks source link

Convenience function to find the strongly connected component of a particular object #79

Open mdickinson opened 4 years ago

mdickinson commented 4 years ago

Often I compute the collection of strongly connected components of a snapshot just to extract the SCC of a particular object:

snapshot = refcycle.snapshot()
scc = next(scc for scc in snapshot.strongly_connected_components() if object_of_interest in scc)

It would be great to be able to write scc = snapshot.scc_containing(object_of_interest) instead.