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

topological sorting for refactoring #31499

Merged
merged 4 commits into from Jul 22, 2022
Merged

topological sorting for refactoring #31499

merged 4 commits into from Jul 22, 2022

Commits on Jul 22, 2022

  1. Implement breadth-first walks and add tests

    Make DAG walks test-able, and add tests for more complex graph ordering.
    We also add breadth-first for comparison, though it's not used currently
    in Terraform.
    jbardin committed Jul 22, 2022
    Copy the full SHA
    95019e3 View commit details
    Browse the repository at this point in the history
  2. Add methods for topological sorts

    A topological walk was previously only done in Terraform via the
    concurrent method used for walking the primary dependency graph in core.
    Sometime however we want a dependency ordering without the overhead of
    instantiating the concurrent walk with the channel-based edges.
    
    Add TopologicalOrder and ReverseTopologicalOrder to obtain a list of
    nodes which can be used to visit each while ensuring that all
    dependencies are satisfied.
    jbardin committed Jul 22, 2022
    Copy the full SHA
    ca272b2 View commit details
    Browse the repository at this point in the history
  3. use TopologicalOrder for evaluating moves

    The dag package did not previously provide a topological walk of a given
    graph. While the existing combination of a transitive reduction with a
    depth-first walk appeared to accomplish this, depth-first is only
    equivalent with a simple tree. If there are multiple paths to a node, a
    depth-first approach will skip dependencies from alternate paths.
    jbardin committed Jul 22, 2022
    Copy the full SHA
    dc9d710 View commit details
    Browse the repository at this point in the history
  4. goimports

    jbardin committed Jul 22, 2022
    Copy the full SHA
    e3ca4be View commit details
    Browse the repository at this point in the history