Sort nodes.