* toNodeMap() method is extracted