Sort graphs