@SuppressWarnings("SameParameterValue")
    public void generateGraph(final StringBuilder sb, final String indent)
    {
        sb.append(indent).append("digraph G {\n");
        transitionsByInteraction.values().forEach(
            (transitionsForContext) ->
            {
                transitionsForContext.forEach(
                    (transition) ->
                    {
                        transition.forEachStartState(
                            (startState) ->
                            {
                                sb.append(indent).append("    ")
                                    .append(startState.name)
                                    .append(" -> ")
                                    .append(transition.endState().name)
                                    .append(" [label=\"  ").append(transition.interaction.exampleCode());

                                if (!transition.interaction.exampleConditions().isEmpty())
                                {
                                    sb.append("\\n").append("  where ")
                                        .append(transition.interaction.exampleConditions());
                                }

                                sb.append("  \"];\n");
                            });
                    });
            });
        sb.append(indent).append("}\n");
    }
Encodes the state machine as a graphviz dot diagram.
@param sb the string builder to append to.
@param indent the indentation to use.
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/common/FieldPrecedenceModel.java