---
title: "Comment by Rattanak Chea on \"BFS - Breadth-First Search - easy\" | Hashnode"
description: "In the code, is it assumed that there is always a path to person_to_find? The while loop could potentially run infinitely if not found?"
url: "https://hashnode.com/posts/bfs-breadth-first-search-easy/5c4c92ad86ae9b1b6b0e99cc/comment/5c4d43aec30d058d61cb95c6"
---

[Discussion](https://hashnode.com/posts/bfs-breadth-first-search-easy/5c4c92ad86ae9b1b6b0e99cc)

Comment [BFS - Breadth-First Search - easy](https://hashnode.com/posts/bfs-breadth-first-search-easy/5c4c92ad86ae9b1b6b0e99cc)

[Rattanak Chea](https://hashnode.com/@rattanak)

[Jan 27, 2019](https://hashnode.com/posts/bfs-breadth-first-search-easy/5c4c92ad86ae9b1b6b0e99cc/comment/5c4d43aec30d058d61cb95c6)

In the code, is it assumed that there is always a path to person\_to\_find? The while loop could potentially run infinitely if not found?

[Benny Elgazar](https://hashnode.com/@Benny)

[Jan 27, 2019](https://hashnode.com/posts/bfs-breadth-first-search-easy/5c4c92ad86ae9b1b6b0e99cc/comment/5c4d43aec30d058d61cb95c6#reply-5c4d4666b99429ff02b202f2)

Your are right, it was meant to be `while not lookup_queue.empty()`.

Thanks.
