Sort generated graphs

Graphs are added to the data array in a ordered manner to ensure the sorting