(
node_count: int, edge_count: int
)
| 6 | |
| 7 | |
| 8 | def initialize_unweighted_directed_graph( |
| 9 | node_count: int, edge_count: int |
| 10 | ) -> dict[int, list[int]]: |
| 11 | graph: dict[int, list[int]] = {} |
| 12 | for i in range(node_count): |
| 13 | graph[i + 1] = [] |
| 14 | |
| 15 | for e in range(edge_count): |
| 16 | x, y = (int(i) for i in _input(f"Edge {e + 1}: <node1> <node2> ")) |
| 17 | graph[x].append(y) |
| 18 | return graph |
| 19 | |
| 20 | |
| 21 | def initialize_unweighted_undirected_graph( |