Write the function to generate every path according to the data