private bool RunTransformations(Func<string, Stream> builderGraphStreamFactory = null)
{
bool cancel = false;
int i = 0;
foreach (Func<ISet<EquatableEdge<IBuilder>>, bool> graphTransformation in graphTransformations)
{
if (!graphTransformation(builders))
{
cancel = true;
break;
}
if (builderGraphStreamFactory != null)
{
using (var stepStream = builderGraphStreamFactory("step" + i++))
{
var graph = builders.ToAdjacencyGraph<IBuilder, EquatableEdge<IBuilder>>();
graph.RemoveEdgeIf(edge => edge.IsSelfEdge<IBuilder, EquatableEdge<IBuilder>>());
DumpGraph(stepStream, graph);
}
}
}
return cancel;
}