Graph-Search: Initial scaffolding

This commit is contained in:
2025-10-08 11:08:58 -04:00
parent 555e084620
commit ac34fbcb83
5 changed files with 68562 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
"""
name: Nicholas Tamassia
Honor Code and Acknowledgments:
This work complies with the JMU Honor Code.
Comments here on your code and submission.
"""
from collections import deque
def whatever_first_search(
graph: dict[str, set[str]], start: str, stop: str
) -> list[str]:
return []
# All modules for CS 412 must include a main method that allows it
# to imported and invoked from other python scripts
def main():
n: int = int(input())
graph: dict[str, set[str]] = {}
for _ in range(0, n):
u, v = input().split()
if u not in graph:
graph[u] = set([v])
else:
graph[u].add(v)
target = input().split()
path = whatever_first_search(graph, target[0], target[1])
if len(path) == 0:
print("no route possible")
else:
print(" ".join(path))
if __name__ == "__main__":
main()