Finding path with function which determine if a node is available