Fix number of graph nodes in sort inputs