Change matrix so that all nodes should be in range.