The literal answer to your question is to evaluate:
myDiagram.nodes.all(function(n) { return n.linksConnected.count > 1; })
For highlighting unconnected nodes you could do something like:
myDiagram.nodes.each(function(n) {
var border = n.findObject(...);
if (border !== null) border.stroke = (n.linksConnected.count === 0) ? "red" : null;
});
This assumes that your node template has a main element of an “Auto” Panel with some name (that I did not specify above) that acts as the highlighting border, and that the border when not highlighting has a stroke of null or “transparent”.
However, executing the above code is inconvenient (when would you call it?) and inefficient (it operates on all of the nodes of the diagram). Another possibility is to define Node.linkConnected and Node.linkDisconnected event handlers. http://gojs.net/latest/api/symbols/Node.html#linkConnected
The Pipes sample demonstrates using these event handlers for automatically hiding/showing ports:
// hide a port when it is connected
linkConnected: function(node, link, port) {
port.visible = false;
},
linkDisconnected: function(node, link, port) {
port.visible = true;
}
But you could use these event handlers for setting the border’s Shape.stroke to either “red” or null. Note especially that these event handlers do not allow adding/removing/reconnecting any links.