Graph is implemented as dictionary of adjacency lists. Also, Source vertex have to be defined upon initialization.
(self, graph: dict[str, list[str]], source_vertex: str)
| 17 | |
| 18 | class Graph: |
| 19 | def __init__(self, graph: dict[str, list[str]], source_vertex: str) -> None: |
| 20 | """ |
| 21 | Graph is implemented as dictionary of adjacency lists. Also, |
| 22 | Source vertex have to be defined upon initialization. |
| 23 | """ |
| 24 | self.graph = graph |
| 25 | # mapping node to its parent in resulting breadth first tree |
| 26 | self.parent: dict[str, str | None] = {} |
| 27 | self.source_vertex = source_vertex |
| 28 | |
| 29 | def breath_first_search(self) -> None: |
| 30 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected