finding a suitable reference node also works with non-connected nodes or empty databases