Graph-Search: Initial scaffolding
This commit is contained in:
47
Graph-Search/cs412_bus_stops_a.py
Normal file
47
Graph-Search/cs412_bus_stops_a.py
Normal 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()
|
||||
Reference in New Issue
Block a user