getTerminalNodeIDs function

Get terminal node IDs (deprecated)