Detection of closest nodes