What is the meaning of 'breadth' in breadth first search? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Unique path in a directed graphWhen would best first search be worse than breadth first search?Dijkstra algorithm vs breadth first search for shortest path in graphHow do we generate a depth-first forest from the Depth First Search?Time complexity of Depth First SearchBreadth First Search actually require specifically Queue instead of any other type of Collection?Understanding connection between minimum spanning tree, shortest path, breadth first and depth first traversalProof that G is a Tree After DFS and BFS form the same tree TDijkstra’s versus Lowest-cost-first (best first), resolving some contradictions regarding complexity analysisIs Breadth First Search Space Complexity on a Grid different?

Besides transaction validation, are there any other uses of the Script language in Bitcoin

Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?

Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?

Is there a verb for listening stealthily?

How to resize main filesystem

How does TikZ render an arc?

"Destructive power" carried by a B-52?

Determine whether an integer is a palindrome

Marquee sign letters

Why are current probes so expensive?

Russian equivalents of おしゃれは足元から (Every good outfit starts with the shoes)

Problem with display of presentation

Vertical ranges of Column Plots in 12

Why do C and C++ allow the expression (int) + 4*5;

Centre cell vertically in tabularx

Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?

One-one communication

Why is there so little support for joining EFTA in the British parliament?

Inverse square law not accurate for non-point masses?

Fit odd number of triplets in a measure?

How can I prevent/balance waiting and turtling as a response to cooldown mechanics

Baking rewards as operations

An isoperimetric-type inequality inside a cube

Any stored/leased 737s that could substitute for grounded MAXs?



What is the meaning of 'breadth' in breadth first search?



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Unique path in a directed graphWhen would best first search be worse than breadth first search?Dijkstra algorithm vs breadth first search for shortest path in graphHow do we generate a depth-first forest from the Depth First Search?Time complexity of Depth First SearchBreadth First Search actually require specifically Queue instead of any other type of Collection?Understanding connection between minimum spanning tree, shortest path, breadth first and depth first traversalProof that G is a Tree After DFS and BFS form the same tree TDijkstra’s versus Lowest-cost-first (best first), resolving some contradictions regarding complexity analysisIs Breadth First Search Space Complexity on a Grid different?










11












$begingroup$


I was learning about breadth first search and a question came in my mind that why BFS is called so. In the book Introduction to Algorithms by CLRS, I read the following reason for this:




Breadth-first search is so named because it expands the frontier
between discovered and undiscovered vertices uniformly across the
breadth of the frontier.




However, I'm not able to understand the meaning of this statement. I'm confused about this word "frontier" and breadth of that frontier.



So, can someone please answer this question in a way which is easy to understand for a beginner like me?










share|cite|improve this question











$endgroup$







  • 4




    $begingroup$
    In case some readers are not familiar with the meaning of the English word (outside of its usage as part of this technical term): merriam-webster.com/dictionary/breadth or dictionary.cambridge.org/dictionary/english/breadth . It's similar to "width", a different dimension than "depth" if you're talking about the size/shape of a physical object. And in the metaphorical sense like depth of knowledge (expert on one subject) vs. breadth of knowledge (lots of subjects).
    $endgroup$
    – Peter Cordes
    2 days ago
















11












$begingroup$


I was learning about breadth first search and a question came in my mind that why BFS is called so. In the book Introduction to Algorithms by CLRS, I read the following reason for this:




Breadth-first search is so named because it expands the frontier
between discovered and undiscovered vertices uniformly across the
breadth of the frontier.




However, I'm not able to understand the meaning of this statement. I'm confused about this word "frontier" and breadth of that frontier.



So, can someone please answer this question in a way which is easy to understand for a beginner like me?










share|cite|improve this question











$endgroup$







  • 4




    $begingroup$
    In case some readers are not familiar with the meaning of the English word (outside of its usage as part of this technical term): merriam-webster.com/dictionary/breadth or dictionary.cambridge.org/dictionary/english/breadth . It's similar to "width", a different dimension than "depth" if you're talking about the size/shape of a physical object. And in the metaphorical sense like depth of knowledge (expert on one subject) vs. breadth of knowledge (lots of subjects).
    $endgroup$
    – Peter Cordes
    2 days ago














11












11








11


2



$begingroup$


I was learning about breadth first search and a question came in my mind that why BFS is called so. In the book Introduction to Algorithms by CLRS, I read the following reason for this:




Breadth-first search is so named because it expands the frontier
between discovered and undiscovered vertices uniformly across the
breadth of the frontier.




However, I'm not able to understand the meaning of this statement. I'm confused about this word "frontier" and breadth of that frontier.



So, can someone please answer this question in a way which is easy to understand for a beginner like me?










share|cite|improve this question











$endgroup$




I was learning about breadth first search and a question came in my mind that why BFS is called so. In the book Introduction to Algorithms by CLRS, I read the following reason for this:




Breadth-first search is so named because it expands the frontier
between discovered and undiscovered vertices uniformly across the
breadth of the frontier.




However, I'm not able to understand the meaning of this statement. I'm confused about this word "frontier" and breadth of that frontier.



So, can someone please answer this question in a way which is easy to understand for a beginner like me?







graphs graph-theory shortest-path graph-traversal






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 2 days ago







DG4

















asked 2 days ago









DG4DG4

1667




1667







  • 4




    $begingroup$
    In case some readers are not familiar with the meaning of the English word (outside of its usage as part of this technical term): merriam-webster.com/dictionary/breadth or dictionary.cambridge.org/dictionary/english/breadth . It's similar to "width", a different dimension than "depth" if you're talking about the size/shape of a physical object. And in the metaphorical sense like depth of knowledge (expert on one subject) vs. breadth of knowledge (lots of subjects).
    $endgroup$
    – Peter Cordes
    2 days ago













  • 4




    $begingroup$
    In case some readers are not familiar with the meaning of the English word (outside of its usage as part of this technical term): merriam-webster.com/dictionary/breadth or dictionary.cambridge.org/dictionary/english/breadth . It's similar to "width", a different dimension than "depth" if you're talking about the size/shape of a physical object. And in the metaphorical sense like depth of knowledge (expert on one subject) vs. breadth of knowledge (lots of subjects).
    $endgroup$
    – Peter Cordes
    2 days ago








4




4




$begingroup$
In case some readers are not familiar with the meaning of the English word (outside of its usage as part of this technical term): merriam-webster.com/dictionary/breadth or dictionary.cambridge.org/dictionary/english/breadth . It's similar to "width", a different dimension than "depth" if you're talking about the size/shape of a physical object. And in the metaphorical sense like depth of knowledge (expert on one subject) vs. breadth of knowledge (lots of subjects).
$endgroup$
– Peter Cordes
2 days ago





$begingroup$
In case some readers are not familiar with the meaning of the English word (outside of its usage as part of this technical term): merriam-webster.com/dictionary/breadth or dictionary.cambridge.org/dictionary/english/breadth . It's similar to "width", a different dimension than "depth" if you're talking about the size/shape of a physical object. And in the metaphorical sense like depth of knowledge (expert on one subject) vs. breadth of knowledge (lots of subjects).
$endgroup$
– Peter Cordes
2 days ago











2 Answers
2






active

oldest

votes


















22












$begingroup$

Consider the data structure used to represent the search. In a BFS, you use a queue. If you come across an unseen node, you add it to the queue.



The “frontier” is the set of all nodes in the search data structure. The queue will will iterate through all nodes on the frontier sequentially, thus iterating across the breadth of the frontier. DFS will always pop the most recently discovered state off of the stack, thus always iterating over the deepest part of the frontier.



Consider the image below. Notice how the DFS goes straight to the deepest parts of the tree whereas BFS iterates over the breadth of each level.



dfs bfs



Image here






share|cite|improve this answer








New contributor




Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$








  • 1




    $begingroup$
    I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
    $endgroup$
    – Theodoros Chatzigiannakis
    yesterday











  • $begingroup$
    I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
    $endgroup$
    – Bryce Kille
    yesterday


















2












$begingroup$

The quote you gives says "the frontier between discovered and undiscovered vertices". So that's the frontier the author is talking about: the frontier between discovered and undiscovered vertices. You have some vertices that you haven't seen anything at all yet. You also have some vertices for which you've seen everything for. And then you have vertices in between. These are vertices that you've looked at, but you haven't loaded all of their children yet. This is the frontier.



The discusses this further on:




To keep track of progress BFS colors each vertex white, gray, or black. All vertices start out white and may later become gray and then black. The vertex is discovered the first time it is encountered during the search, at which time it becomes non-white. Gray and black vertices, therefore, have been discovered, but BFS distinguishes between them to ensure that the search proceeds in a BF manner.

...

each vertex is initially white, is grayed when it is discovered in the search, and is blacked when it is finished, that is, when its adjacency list has been examined completely.




So all vertices start out white (undiscovered). When a node is discovered, it's colored gray (frontier). When everything it points to has been discovered, it's colored black (completely discovered). The frontier is the set of points that have been discovered, but have undiscovered children.



Suppose you are looking for something on website. You first go to the main page. Suppose that's labelled "animals". The frontier is currently "animals". You look through the main page and don't see what you are looking for. But you notice that it has links to two more pages, "quadrupeds" and "worms". So you click on the link to "quadrupeds". Now the frontier is "animals","quadrupeds". You look through "quadrupeds" and don't find what you're look for. What do you do next? You can either look for links on "quadrupeds" and follow those, or go back to "animals" and click on the link to "worms". The first is a depth-first search, and the second is a breadth-first search.



"depth" refers to how many links from the root node it takes to get to a node, while "breadth" refers to nodes as the same depth. In the example above, BFS starts at "animals" and first looks at all the nodes of depth one, so it looks at "quadrupeds" and "worms" first. After it has looked at all the depth-1 nodes, its expands the frontier across all of those nodes; that is, it looks at the children of all of the depth-1 nodes before looking at any of the children of depth-2 nodes. So, for instance, if one of the links on the "quadrupeds" page is "primates", it will look at all of the links on the "worms" page before it looks at any of the links on the "primates" page.






share|cite|improve this answer









$endgroup$













    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "419"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f107187%2fwhat-is-the-meaning-of-breadth-in-breadth-first-search%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    22












    $begingroup$

    Consider the data structure used to represent the search. In a BFS, you use a queue. If you come across an unseen node, you add it to the queue.



    The “frontier” is the set of all nodes in the search data structure. The queue will will iterate through all nodes on the frontier sequentially, thus iterating across the breadth of the frontier. DFS will always pop the most recently discovered state off of the stack, thus always iterating over the deepest part of the frontier.



    Consider the image below. Notice how the DFS goes straight to the deepest parts of the tree whereas BFS iterates over the breadth of each level.



    dfs bfs



    Image here






    share|cite|improve this answer








    New contributor




    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    $endgroup$








    • 1




      $begingroup$
      I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
      $endgroup$
      – Theodoros Chatzigiannakis
      yesterday











    • $begingroup$
      I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
      $endgroup$
      – Bryce Kille
      yesterday















    22












    $begingroup$

    Consider the data structure used to represent the search. In a BFS, you use a queue. If you come across an unseen node, you add it to the queue.



    The “frontier” is the set of all nodes in the search data structure. The queue will will iterate through all nodes on the frontier sequentially, thus iterating across the breadth of the frontier. DFS will always pop the most recently discovered state off of the stack, thus always iterating over the deepest part of the frontier.



    Consider the image below. Notice how the DFS goes straight to the deepest parts of the tree whereas BFS iterates over the breadth of each level.



    dfs bfs



    Image here






    share|cite|improve this answer








    New contributor




    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    $endgroup$








    • 1




      $begingroup$
      I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
      $endgroup$
      – Theodoros Chatzigiannakis
      yesterday











    • $begingroup$
      I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
      $endgroup$
      – Bryce Kille
      yesterday













    22












    22








    22





    $begingroup$

    Consider the data structure used to represent the search. In a BFS, you use a queue. If you come across an unseen node, you add it to the queue.



    The “frontier” is the set of all nodes in the search data structure. The queue will will iterate through all nodes on the frontier sequentially, thus iterating across the breadth of the frontier. DFS will always pop the most recently discovered state off of the stack, thus always iterating over the deepest part of the frontier.



    Consider the image below. Notice how the DFS goes straight to the deepest parts of the tree whereas BFS iterates over the breadth of each level.



    dfs bfs



    Image here






    share|cite|improve this answer








    New contributor




    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    $endgroup$



    Consider the data structure used to represent the search. In a BFS, you use a queue. If you come across an unseen node, you add it to the queue.



    The “frontier” is the set of all nodes in the search data structure. The queue will will iterate through all nodes on the frontier sequentially, thus iterating across the breadth of the frontier. DFS will always pop the most recently discovered state off of the stack, thus always iterating over the deepest part of the frontier.



    Consider the image below. Notice how the DFS goes straight to the deepest parts of the tree whereas BFS iterates over the breadth of each level.



    dfs bfs



    Image here







    share|cite|improve this answer








    New contributor




    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    share|cite|improve this answer



    share|cite|improve this answer






    New contributor




    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    answered 2 days ago









    Bryce KilleBryce Kille

    363111




    363111




    New contributor




    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





    New contributor





    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    Bryce Kille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    • 1




      $begingroup$
      I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
      $endgroup$
      – Theodoros Chatzigiannakis
      yesterday











    • $begingroup$
      I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
      $endgroup$
      – Bryce Kille
      yesterday












    • 1




      $begingroup$
      I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
      $endgroup$
      – Theodoros Chatzigiannakis
      yesterday











    • $begingroup$
      I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
      $endgroup$
      – Bryce Kille
      yesterday







    1




    1




    $begingroup$
    I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
    $endgroup$
    – Theodoros Chatzigiannakis
    yesterday





    $begingroup$
    I think the word frontier might refer to the edge of the discovered nodes. When you've only discovered a, the frontier is a. When you've discovered a, b, c, the frontier is b, c. When you've discovered a, b, c, d, e, f, g, the frontier is d, e, f, g. In other words, the nodes that have been discovered and that we haven't searched beyond yet.
    $endgroup$
    – Theodoros Chatzigiannakis
    yesterday













    $begingroup$
    I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
    $endgroup$
    – Bryce Kille
    yesterday




    $begingroup$
    I think this is a fair point, but I think that “frontier” can be interpreted multiple ways, with the general explanation above still working.
    $endgroup$
    – Bryce Kille
    yesterday











    2












    $begingroup$

    The quote you gives says "the frontier between discovered and undiscovered vertices". So that's the frontier the author is talking about: the frontier between discovered and undiscovered vertices. You have some vertices that you haven't seen anything at all yet. You also have some vertices for which you've seen everything for. And then you have vertices in between. These are vertices that you've looked at, but you haven't loaded all of their children yet. This is the frontier.



    The discusses this further on:




    To keep track of progress BFS colors each vertex white, gray, or black. All vertices start out white and may later become gray and then black. The vertex is discovered the first time it is encountered during the search, at which time it becomes non-white. Gray and black vertices, therefore, have been discovered, but BFS distinguishes between them to ensure that the search proceeds in a BF manner.

    ...

    each vertex is initially white, is grayed when it is discovered in the search, and is blacked when it is finished, that is, when its adjacency list has been examined completely.




    So all vertices start out white (undiscovered). When a node is discovered, it's colored gray (frontier). When everything it points to has been discovered, it's colored black (completely discovered). The frontier is the set of points that have been discovered, but have undiscovered children.



    Suppose you are looking for something on website. You first go to the main page. Suppose that's labelled "animals". The frontier is currently "animals". You look through the main page and don't see what you are looking for. But you notice that it has links to two more pages, "quadrupeds" and "worms". So you click on the link to "quadrupeds". Now the frontier is "animals","quadrupeds". You look through "quadrupeds" and don't find what you're look for. What do you do next? You can either look for links on "quadrupeds" and follow those, or go back to "animals" and click on the link to "worms". The first is a depth-first search, and the second is a breadth-first search.



    "depth" refers to how many links from the root node it takes to get to a node, while "breadth" refers to nodes as the same depth. In the example above, BFS starts at "animals" and first looks at all the nodes of depth one, so it looks at "quadrupeds" and "worms" first. After it has looked at all the depth-1 nodes, its expands the frontier across all of those nodes; that is, it looks at the children of all of the depth-1 nodes before looking at any of the children of depth-2 nodes. So, for instance, if one of the links on the "quadrupeds" page is "primates", it will look at all of the links on the "worms" page before it looks at any of the links on the "primates" page.






    share|cite|improve this answer









    $endgroup$

















      2












      $begingroup$

      The quote you gives says "the frontier between discovered and undiscovered vertices". So that's the frontier the author is talking about: the frontier between discovered and undiscovered vertices. You have some vertices that you haven't seen anything at all yet. You also have some vertices for which you've seen everything for. And then you have vertices in between. These are vertices that you've looked at, but you haven't loaded all of their children yet. This is the frontier.



      The discusses this further on:




      To keep track of progress BFS colors each vertex white, gray, or black. All vertices start out white and may later become gray and then black. The vertex is discovered the first time it is encountered during the search, at which time it becomes non-white. Gray and black vertices, therefore, have been discovered, but BFS distinguishes between them to ensure that the search proceeds in a BF manner.

      ...

      each vertex is initially white, is grayed when it is discovered in the search, and is blacked when it is finished, that is, when its adjacency list has been examined completely.




      So all vertices start out white (undiscovered). When a node is discovered, it's colored gray (frontier). When everything it points to has been discovered, it's colored black (completely discovered). The frontier is the set of points that have been discovered, but have undiscovered children.



      Suppose you are looking for something on website. You first go to the main page. Suppose that's labelled "animals". The frontier is currently "animals". You look through the main page and don't see what you are looking for. But you notice that it has links to two more pages, "quadrupeds" and "worms". So you click on the link to "quadrupeds". Now the frontier is "animals","quadrupeds". You look through "quadrupeds" and don't find what you're look for. What do you do next? You can either look for links on "quadrupeds" and follow those, or go back to "animals" and click on the link to "worms". The first is a depth-first search, and the second is a breadth-first search.



      "depth" refers to how many links from the root node it takes to get to a node, while "breadth" refers to nodes as the same depth. In the example above, BFS starts at "animals" and first looks at all the nodes of depth one, so it looks at "quadrupeds" and "worms" first. After it has looked at all the depth-1 nodes, its expands the frontier across all of those nodes; that is, it looks at the children of all of the depth-1 nodes before looking at any of the children of depth-2 nodes. So, for instance, if one of the links on the "quadrupeds" page is "primates", it will look at all of the links on the "worms" page before it looks at any of the links on the "primates" page.






      share|cite|improve this answer









      $endgroup$















        2












        2








        2





        $begingroup$

        The quote you gives says "the frontier between discovered and undiscovered vertices". So that's the frontier the author is talking about: the frontier between discovered and undiscovered vertices. You have some vertices that you haven't seen anything at all yet. You also have some vertices for which you've seen everything for. And then you have vertices in between. These are vertices that you've looked at, but you haven't loaded all of their children yet. This is the frontier.



        The discusses this further on:




        To keep track of progress BFS colors each vertex white, gray, or black. All vertices start out white and may later become gray and then black. The vertex is discovered the first time it is encountered during the search, at which time it becomes non-white. Gray and black vertices, therefore, have been discovered, but BFS distinguishes between them to ensure that the search proceeds in a BF manner.

        ...

        each vertex is initially white, is grayed when it is discovered in the search, and is blacked when it is finished, that is, when its adjacency list has been examined completely.




        So all vertices start out white (undiscovered). When a node is discovered, it's colored gray (frontier). When everything it points to has been discovered, it's colored black (completely discovered). The frontier is the set of points that have been discovered, but have undiscovered children.



        Suppose you are looking for something on website. You first go to the main page. Suppose that's labelled "animals". The frontier is currently "animals". You look through the main page and don't see what you are looking for. But you notice that it has links to two more pages, "quadrupeds" and "worms". So you click on the link to "quadrupeds". Now the frontier is "animals","quadrupeds". You look through "quadrupeds" and don't find what you're look for. What do you do next? You can either look for links on "quadrupeds" and follow those, or go back to "animals" and click on the link to "worms". The first is a depth-first search, and the second is a breadth-first search.



        "depth" refers to how many links from the root node it takes to get to a node, while "breadth" refers to nodes as the same depth. In the example above, BFS starts at "animals" and first looks at all the nodes of depth one, so it looks at "quadrupeds" and "worms" first. After it has looked at all the depth-1 nodes, its expands the frontier across all of those nodes; that is, it looks at the children of all of the depth-1 nodes before looking at any of the children of depth-2 nodes. So, for instance, if one of the links on the "quadrupeds" page is "primates", it will look at all of the links on the "worms" page before it looks at any of the links on the "primates" page.






        share|cite|improve this answer









        $endgroup$



        The quote you gives says "the frontier between discovered and undiscovered vertices". So that's the frontier the author is talking about: the frontier between discovered and undiscovered vertices. You have some vertices that you haven't seen anything at all yet. You also have some vertices for which you've seen everything for. And then you have vertices in between. These are vertices that you've looked at, but you haven't loaded all of their children yet. This is the frontier.



        The discusses this further on:




        To keep track of progress BFS colors each vertex white, gray, or black. All vertices start out white and may later become gray and then black. The vertex is discovered the first time it is encountered during the search, at which time it becomes non-white. Gray and black vertices, therefore, have been discovered, but BFS distinguishes between them to ensure that the search proceeds in a BF manner.

        ...

        each vertex is initially white, is grayed when it is discovered in the search, and is blacked when it is finished, that is, when its adjacency list has been examined completely.




        So all vertices start out white (undiscovered). When a node is discovered, it's colored gray (frontier). When everything it points to has been discovered, it's colored black (completely discovered). The frontier is the set of points that have been discovered, but have undiscovered children.



        Suppose you are looking for something on website. You first go to the main page. Suppose that's labelled "animals". The frontier is currently "animals". You look through the main page and don't see what you are looking for. But you notice that it has links to two more pages, "quadrupeds" and "worms". So you click on the link to "quadrupeds". Now the frontier is "animals","quadrupeds". You look through "quadrupeds" and don't find what you're look for. What do you do next? You can either look for links on "quadrupeds" and follow those, or go back to "animals" and click on the link to "worms". The first is a depth-first search, and the second is a breadth-first search.



        "depth" refers to how many links from the root node it takes to get to a node, while "breadth" refers to nodes as the same depth. In the example above, BFS starts at "animals" and first looks at all the nodes of depth one, so it looks at "quadrupeds" and "worms" first. After it has looked at all the depth-1 nodes, its expands the frontier across all of those nodes; that is, it looks at the children of all of the depth-1 nodes before looking at any of the children of depth-2 nodes. So, for instance, if one of the links on the "quadrupeds" page is "primates", it will look at all of the links on the "worms" page before it looks at any of the links on the "primates" page.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered 2 days ago









        AcccumulationAcccumulation

        1394




        1394



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Computer Science Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f107187%2fwhat-is-the-meaning-of-breadth-in-breadth-first-search%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form