How to get the total count of Nodes on Diagram

I have a diagram with some n-number of Nodes, Is there a method to get the total counts\ of the nodes present in the diagram also I need to call this method in a listener which will get trigger as soon as the diagram loads.

myDiagram.nodes.count

You don’t have to wait until an “InitialLayoutCompleted” DiagramEvent – you can just look at myDiagram.model.nodeDataArray.length.

Thank you!!