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

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.

Task

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 2. Chapter 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.

Task

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 2. Chapter 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.

Task

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 2. Chapter 2
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt