graphs.connected_components¶
https://en.wikipedia.org/wiki/Component_(graph_theory)
Finding connected components in graph
Attributes¶
Functions¶
| 
 | This function takes graph as a parameter | 
| 
 | Use depth first search to find all vertices | 
Module Contents¶
- graphs.connected_components.connected_components(graph: dict) list¶
- This function takes graph as a parameter and then returns the list of connected components >>> connected_components(test_graph_1) [[0, 1, 3, 2], [4, 5, 6]] >>> connected_components(test_graph_2) [[0, 1, 3, 2], [4], [5]] 
- graphs.connected_components.dfs(graph: dict, vert: int, visited: list) list¶
- Use depth first search to find all vertices being in the same component as initial vertex >>> dfs(test_graph_1, 0, 5 * [False]) [0, 1, 3, 2] >>> dfs(test_graph_2, 0, 6 * [False]) [0, 1, 3, 2] 
- graphs.connected_components.test_graph_1¶
- graphs.connected_components.test_graph_2¶