3 // TransitiveReductionTransformer is a GraphTransformer that performs
4 // finds the transitive reduction of the graph. For a definition of
5 // transitive reduction, see Wikipedia.
6 type TransitiveReductionTransformer struct{}
8 func (t *TransitiveReductionTransformer) Transform(g *Graph) error {
9 // If the graph isn't valid, skip the transitive reduction.
10 // We don't error here because Terraform itself handles graph
11 // validation in a better way, or we assume it does.
12 if err := g.Validate(); err != nil {
17 g.TransitiveReduction()