Fix find_output_order and add output order to graph's labels.