Optimize ticking in Force Layout

For the default value of alpha (0.1), the tick function is executed 298 times.

If there are no nodes (unlikely; nobody is going to start the force layout without nodes) or all nodes removed in the course of animation (possible), there is no need to continue ticking anymore.

Added a check near the top of tick function to end ticking if the number of nodes is/becomes zero.