Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Check if is One Component | 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

Check if is One Component

BFS: check if graph is one-component

In the previous method, we considered that the graph is one-component. That’s because if you start traversing at some node, you’ll visit only nodes from the same component.

If there are some other components, you should start from vertices of another component.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

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

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

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

Check if is One Component

BFS: check if graph is one-component

In the previous method, we considered that the graph is one-component. That’s because if you start traversing at some node, you’ll visit only nodes from the same component.

If there are some other components, you should start from vertices of another component.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

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

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

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

Check if is One Component

BFS: check if graph is one-component

In the previous method, we considered that the graph is one-component. That’s because if you start traversing at some node, you’ll visit only nodes from the same component.

If there are some other components, you should start from vertices of another component.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

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

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

BFS: check if graph is one-component

In the previous method, we considered that the graph is one-component. That’s because if you start traversing at some node, you’ll visit only nodes from the same component.

If there are some other components, you should start from vertices of another component.

Завдання

Think about Implementation of method hasOneComponent(). which returns True if it is only one component in graph.

Modify your g graph by adding nodes in that way, so there are miltiple components, and check how function works.

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