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

Scorri per mostrare il menu

book
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.

Compito

Swipe to start coding

Implement getComponents() function.

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 5

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

book
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.

Compito

Swipe to start coding

Implement getComponents() function.

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 5
Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt