You can use the -getNodeList flag to print out a list of names of nodes displayed in the Node Editor.
Use the flag in the command line as follows:
nodeEditor -q -getNodeList (nodeEditorName)
getPanel -scriptType "nodeEditorPanel";
You will obtain results similar to the following:
// Result: nodeEditorPanel1 nodeEditorPanel2 //
nodeEditorPanel1 is the editor built in the main Maya window, while nodeEditorPanel2 is the floating editor.
Append NodeEditorEd to the result above, such as: nodeEditorPanel2NodeEditorEd.
The full command therefore becomes: nodeEditor -q -getNodeList nodeEditorPanel2NodeEditorEd;