Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Find All Connected Components | Practice
Breadth First Search
course content

Зміст курсу

Breadth First Search

Breadth First Search

1. What is BFS
2. Practice
3. Improve Your Code
4. Solving the Problems using BFS

Find All Connected Components

BFS find all connected components

Complicate the problem: find all components in a graph.

Some hints for you:

  • When you’re done with the first component, save it, and start traversing again with some nodes that haven’t been visited yet.
  • To split your components, you can use an upgraded visited list: put 0 if vertex is not visited yet, or put k if vertex is in kth component.
  • Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded visited list.

Завдання

Implement getComponents() function.

Завдання

Implement getComponents() function.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 5
toggle bottom row

Find All Connected Components

BFS find all connected components

Complicate the problem: find all components in a graph.

Some hints for you:

  • When you’re done with the first component, save it, and start traversing again with some nodes that haven’t been visited yet.
  • To split your components, you can use an upgraded visited list: put 0 if vertex is not visited yet, or put k if vertex is in kth component.
  • Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded visited list.

Завдання

Implement getComponents() function.

Завдання

Implement getComponents() function.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 5
toggle bottom row

Find All Connected Components

BFS find all connected components

Complicate the problem: find all components in a graph.

Some hints for you:

  • When you’re done with the first component, save it, and start traversing again with some nodes that haven’t been visited yet.
  • To split your components, you can use an upgraded visited list: put 0 if vertex is not visited yet, or put k if vertex is in kth component.
  • Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded visited list.

Завдання

Implement getComponents() function.

Завдання

Implement getComponents() function.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

BFS find all connected components

Complicate the problem: find all components in a graph.

Some hints for you:

  • When you’re done with the first component, save it, and start traversing again with some nodes that haven’t been visited yet.
  • To split your components, you can use an upgraded visited list: put 0 if vertex is not visited yet, or put k if vertex is in kth component.
  • Return tuple of lists of vertex numbers, one list for each component. Create it by using an upgraded visited list.

Завдання

Implement getComponents() function.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 2. Розділ 5
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt