Traverse topological sorting of subgraph

Hello! First off, I wanted to say thank you for working on this package. I am just starting to look into using the Python bindings and have found them very pleasant to work with so far.

I see that there is a topological_sorting method, but I was wondering if there is a way to do the same but for a sub-graph of my DAG?

To make this a bit more general, is there a way to select a sub-graph from a DAG, based on one node and all of it’s recursive children?

If not a topological sort, even just any kind of way to iterate through all the recursive children of a node would be great!

Hi @saulshanabrook, great to hear you find the package pleasant to work with!

I think the easiest would be to use subcomponent to find all nodes that can be reached from a certain node. You can then simply take the induced subgraph of those nodes and apply topological sorting to that subgraph.

Does that do what you want?

1 Like

Thank you @vtraag! That’s perfect.

BTW thank you for your work on the conda package. I just installed the old one today and was like “hm… wonder why the newest version isn’t on conda forge…” and then I saw your PR!

1 Like

I notice that the subcomponent code looks like it might keep the results in some topological order:

I am gonna test this, if so then I don’t have to create another subgraph.

EDIT: Yeah it seems to work as expected.

1 Like