program pencarian lokasi dengan DFS dan BFS menggunakan Python
Source Code DFS dan BFS peta = {'A':set(['B','C','D','F']), 'B':set(['E','C']), 'C':set(['A']), 'D':set(['A','B']), 'E':set(['C']), 'F':set(['A'])} def bfs(graph,start,end): queue=[[start]] visited=set() while queue: rute=queue.pop(0) state=rute[-1] if state==end: return rute elif state not in visited: for cabang in graph.get(state,[]): newrute=list(rute) newrute.append(cabang) queue.append(newrute...