About ForceDirectedLayout

I used ForceDirectedLayout to get the results:


There are two nodes that are far away because there is no link connection.
Q1:I want these two nodes to be closer to the other nodes.Could you give me some advice?
Q2:Computations stop when no vertex moves more than epsilonDistance or when maxIterations have happened.Can I let the computations never stop?

[EDIT: ArrangingForceDirectedLayout has been subsumed by the ArrangingLayout extension in v2.1.23.]

I suggest that you use the ArrangingLayout extension.
It is demonstrated at: Arranging Layout of the Class Hierarchy
It is defined at: https://gojs.net/latest/extensions/ArrangingLayout.js
It is documented at: ArrangingLayout | GoJS API

In your case you’ll want to set ArrangingLayout.primaryLayout to be your ForceDirectedLayout. Disconnected nodes it will automatically arrange along the bottom of the document by a GridLayout.

The ArrangingForceDirectedLayout is what most people want.

But an alternative design is to customize the ForceDirectedLayout so that there are pretend links/edges between the single (disconnected) nodes/vertexes and other already-connected nodes/vertexes.

I notice now that I didn’t answer your second question. There are a number of possibliities. Perhaps you would be interested in Interactive Force Directed Layout ?