Extend node searching stuff to handle nonlinear nodes

as titled and created from #477. Node-distance based search length is required for nonlinear nodes, because nonlinear nodes are located between end points of edges.