delete this file

pull/739/head
Ghada AbdulWahab 2022-04-17 03:34:30 +02:00 committed by GitHub
parent 1eb13d9b7d
commit b8b9d899e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 32 deletions

View File

@ -1,32 +0,0 @@
# this graph to check the algorithm
graph={
'S':['B','D','A'],
'A':['C'],
'B':['D'],
'C':['G','D'],
'S':['G'],
}
#function of DFS
def BFS(graph,start,goal):
Visited=[]
queue=[[start]]
while queue:
path=queue.pop()
node=path[-1]
if node in Visited:
continue
Visited.append(node)
if node==goal:
return path
else:
adjecent_nodes=graph.get(node,[])
for node2 in adjecent_nodes:
new_path=path.copy()
new_path.append(node2)
queue.append(new_path)
Solution=BFS(graph,'S','G')
print('Solution is ',Solution)