Graph Search: Swift
Lesson 1 of 1
  1. 1
    Welcome back to the Graph data structure! In this lesson, we’ll implement graph searching algorithms, also known as traversals. Traversals are incredibly useful when you are trying to find a parti…
  2. 2
    So far, we are able to traverse the entirety of the graph. However, there will be a problem if the graph has a cycle. If there was a cycle, for example a path from one vertex to itself, we would b…
  3. 3
    Now it’s time to focus on breadth-first traversal! As a reminder, the breadth-first traversal iterates through the graph in layers. It goes down one layer, which comprises of the start node’s direc…
  4. 4
    So far, we are able to traverse the entirety of the graph. However, just like for our depth-first traversal, there will be a problem if the graph has a cycle. If a graph contains a cycle, we would…
  5. 5
    Great work! You can now use a variety of tools to traverse and search your graphs. Let’s recap the types of graph search functions we’ve implemented. - Depth-First Search (DFS): DFS explores n…

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory