Solution to find if route exists between two nodes