Is there a way I can apply location binding in ForceDirectedLayout

I have a ForceDirectedLayout diagram. I was trying to rearrange some vertexes locations. I can get it done by just set the nodes’ locations. I want to keep those nodes’ locations fixed then rearrange locations of the other nodes by the ForceDirectedLayout automatically.
In addition, once the layout is finished, I want to save the vertexes locations, so I can load the location then binding the vertexes to the location to initiate the diagram.
Is there a way to do this?

You basically have two questions, and there is an answer for each.

First, about saving and location node locations. Please read:
GoJS Data Binding -- Northwoods Software
GoJS Data Binding -- Northwoods Software
GoJS Data Binding -- Northwoods Software
Basically – add a TwoWay data Binding to your node template to cause the node data in the model to be updated with changes to Node.location.

Then when the model is loaded the nodes will automatically get their locations from the property in the node data. However, by default, a layout will be performed again, thereby losing those restored locations. So whenever you want to load a model and do not want to have a layout be performed, set Layout.isInitial to false before you assign the Diagram.model.

Second, about customizing ForceDirectedLayout not to move certain nodes.

I suggest that you add a property to your node data objects indicating that it has a “fixed” location as far as layout is concerned. Let’s call that property fixed. So then you could use a custom ForceDirectedLayout defined as follows:

class FixedForceDirectedLayout extends go.ForceDirectedLayout {
  isFixed(v) { return v.node &&; }

Install it by using this class as the Diagram.layout:

myDiagram = new go.Diagram(. . .,
    layout: new FixedForceDirectedLayout(),
    . . .

Now you just need to have that data.fixed property set to true if you don’t want the corresponding Node to be moved by the layout.