| 260 | return random_edges |
| 261 | |
| 262 | def __generate_graphs( |
| 263 | self, vertex_count: int, min_val: int, max_val: int, edge_pick_count: int |
| 264 | ) -> tuple[GraphAdjacencyMatrix, GraphAdjacencyMatrix, list[int], list[list[int]]]: |
| 265 | if max_val - min_val + 1 < vertex_count: |
| 266 | raise ValueError( |
| 267 | "Will result in duplicate vertices. Either increase " |
| 268 | "range between min_val and max_val or decrease vertex count" |
| 269 | ) |
| 270 | |
| 271 | # generate graph input |
| 272 | random_vertices: list[int] = random.sample( |
| 273 | range(min_val, max_val + 1), vertex_count |
| 274 | ) |
| 275 | random_edges: list[list[int]] = self.__generate_random_edges( |
| 276 | random_vertices, edge_pick_count |
| 277 | ) |
| 278 | |
| 279 | # build graphs |
| 280 | undirected_graph = GraphAdjacencyMatrix( |
| 281 | vertices=random_vertices, edges=random_edges, directed=False |
| 282 | ) |
| 283 | directed_graph = GraphAdjacencyMatrix( |
| 284 | vertices=random_vertices, edges=random_edges, directed=True |
| 285 | ) |
| 286 | |
| 287 | return undirected_graph, directed_graph, random_vertices, random_edges |
| 288 | |
| 289 | def test_init_check(self) -> None: |
| 290 | ( |