Drag selected nodes or Parts only if link exists

When we use Ctrl and select nodes later if we drag the parts will be draggable even if there is no connection exists…
I want the parts to be selected and draggable only if there exists a connection…
how i can achieve this???

One possibility is to override DraggingTool.computeEffectiveCollection to not include any Nodes that do not have any Links connected that are going to be dragged.

Something like this:

$(go.Diagram, . . .,
  { . . .,
    "draggingTool.computeEffectiveCollection": function(parts) {
      var map = go.DraggingTool.prototype.computeEffectiveCollection.call(this, parts);
      var discos = new go.Set();
      parts.each(function(n) {
        if (!(n instanceof go.Node)) return;
        // if a Node has no connected Links that are in the already computed effective collection of Parts to drag,
        // remove the Node from that collection (which is a Map)
        if (!n.linksConnected.any(function(l) { return map.contains(l); })) discos.add(n);
      discos.each(function(n) { map.remove(n); });
      return map;

Caution: I haven’t had a chance to try this code.

yes it worked nodes which dont have link are not draggable…
but i have an issue…
Node with no link is Rotating with nodes with links…
how i can avoid this?

What do you mean by “Node with no link is Rotating with nodes with links.” If this is a different issue, please start a separate forum topic. If this is the same issue, please describe in more detail what is going on, what you don’t want, and show what you do want instead.

sorry about my question…
let me specify it…
as show in fig…

  1. If there any link exists between alpha and beta and if i drag only beta or alpha both should be drag simultaneously.
  2. If there is no connection between Alpha and Beta…if i drag Alpha then alone should drag…
    hope u understood my scenario

You can change the code to allow the exceptional case where there is a single node without any connected links.