flows = SmartAnswer::FlowRegistry.instance.flows
data = flows.sort_by(&:name).inject({}) do |hash, flow|
  hash[flow.name] = flow.questions.sort_by(&:name).inject({}) do |q_vs_pnn, question|
    q_vs_pnn[question.name] = question.permitted_next_nodes.sort
    q_vs_pnn
  end
  hash
end

path = Rails.root.join('test', 'data', 'permitted-next-nodes.yml')
File.write(path, data.to_yaml)

Add script to generate permitted next nodes for all flows
Add script to generate permitted next nodes for all flows

I'm about to change all the flows to use the  mechanism for automatically
detecting permitted next nodes. Although the existing tests, particularly
the regression tests should give a lot of confidence that nothing gets
broken, I'm hoping to compare the results of this script before and after
the changes as a double-check.
