mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
4ca508294c
Remove extra word and add link to Wikipedia article
21 lines
640 B
Go
21 lines
640 B
Go
package terraform
|
|
|
|
// TransitiveReductionTransformer is a GraphTransformer that
|
|
// finds the transitive reduction of the graph. For a definition of
|
|
// transitive reduction, see [Wikipedia](https://en.wikipedia.org/wiki/Transitive_reduction).
|
|
type TransitiveReductionTransformer struct{}
|
|
|
|
func (t *TransitiveReductionTransformer) Transform(g *Graph) error {
|
|
// If the graph isn't valid, skip the transitive reduction.
|
|
// We don't error here because Terraform itself handles graph
|
|
// validation in a better way, or we assume it does.
|
|
if err := g.Validate(); err != nil {
|
|
return nil
|
|
}
|
|
|
|
// Do it
|
|
g.TransitiveReduction()
|
|
|
|
return nil
|
|
}
|