Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source components' descendants #44

Open
rkern opened this issue Feb 19, 2014 · 4 comments
Open

Source components' descendants #44

rkern opened this issue Feb 19, 2014 · 4 comments

Comments

@rkern
Copy link
Contributor

rkern commented Feb 19, 2014

I'd love to be able to export a .dot file from an ObjectGraph that contains a subgraph of a garbage snapshot that contains just a specified source component and its descendants (to a configurable number of generations). With the source component subgraph highlighted in red, of course.

g = refcycle.garbage()
sources = g.source_components()
subgraph = g.subgraph_descendants(sources[0], generations=5)
subgraph.write_to_dot('garbage.dot', highlight_subgraph=sources[0])
@mdickinson
Copy link
Owner

Does the "number of generations" here refer to depth in the original graph or depth in the graph of strongly connected components? That is, with generations=1, would you want to get all the complete components reachable from the source component, or just the nodes of the original graph reachable from the source component in a single step?

@mdickinson
Copy link
Owner

in red, of course

Of course!

@rkern
Copy link
Contributor Author

rkern commented Feb 20, 2014

Generations of nodes. I imagine subgraph_descendants() as agnostic to the nature of the subgraph it is looking at. For that matter, a more general method would just take an iterable of nodes, but all of my actual use cases involve subgraphs.

@rkern
Copy link
Contributor Author

rkern commented Feb 20, 2014

If you want to highlight all of the non-source SCCs in blue, that would be cool, too. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants