improved algorithm that determines the position of a new node in the graph editor