1 / 16

Breadth first search

Breadth first search. Breadth first search. Structures for BFS. Implementation. ( Δ , D) – graph. Breadth first search. BFS by practice. We start from a source node. We want to see if we can reach a target node. We proceed by waves. target. source. Breadth first search.

isha
Download Presentation

Breadth first search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Breadth first search

  2. Breadth first search Structures for BFS Implementation (Δ, D) – graph Breadth first search

  3. BFS by practice

  4. We start from a source node. We want to see if we can reach a target node. We proceed by waves. target source Breadth first search

  5. We start from a source node. We want to see if we can reach a target node. We proceed by waves. target source 3 waves total. Breadth first search

  6. • a Queue, in which we add neighbours and from which we select the next one to visit • a Dictionary: to each node that we visited we bind as value its predecessor. 2 data structures pred: Danish pred: Awin pred: Shivam target pred: Pranil pred: Pranil pred: Pranil source pred: Robin Breadth first search

  7. Implementation

  8. (Δ, D) – graph

  9. Distance The number of hops it takes to go from A to B is called the distance from A to B and denoted d(A,B). 2 hops 1 hop 3 hops d(Pranil,Som) = 3 Breadth first search

  10. Distance The number of hops it takes to go from A to B is called the distance from A to B and denoted d(A,B). 2 1 We use the shortest path. d(Danish,Aram) = 2 Breadth first search

  11. Diameter The diameter of a graph is the maximum distance between two vertices, and is denoted D. D = 5 Breadth first search

  12. (Δ, D) – graph Let Δ be the maximum degree in a graph, i.e. the largest number of neighbours that any node can have. Let D be the diameter. For a given Δ and D, design the graph having as many nodes as possible. Example: we want to create a good network of workstations. Each workstation can be connected to at most 3, and the diameter must be 1. The best (3, 1) – graph has 4 nodes. Breadth first search

  13. (Δ, D) – graph Let Δ be the maximum degree in a graph, i.e. the largest number of neighbours that any node can have. Let D be the diameter. For a given Δ and D, design the graph having as many nodes as possible. Practice: draw the best (3, 2) – graph possible. The best (3, 1) – graph has 4 nodes. Breadth first search

  14. (Δ, D) – graph Practice: draw the best (3, 2) – graph possible. 5 6 7 8 10 Breadth first search

  15. Breadth first search

  16. Pavol Hell, SFU Jean-Claude Bermond, Université de Nice The network teams from Nice and SFU are associated. Breadth first search

More Related