How can I get this?

To judge each node contains…
Thank you.

Use Groups: http://gojs.net/latest/intro/groups.html