PQ1.push(start+'->'+v.get_id(), g.get_vertex('lafayette').distance1(v)) if a==1: GBFS1(g, stop, PQ1, route, rslt) return 0 if __name__ == '__main__': g = Graph() PQ=PriorityQueue() results=[] route={} f=open('input.txt', 'r') f.readline() k=f.readline() while (k!= 'Edges:\n'): p=k.split(', ') g.add_vertex(p[0], p[1], p[2]) k=f.readline() while(k !=None): if(k==''): break elif(k!= 'Edges:\n'): p=k.split(', ') g.add_edge(p[0], p[1], int(p[2])) k=f.readline() else: k=f.readline() continue PQ.push('houston', 0) g.get_vertex('houston').visited='yes' route['houston']=0
DFS(vetc[x], stop, stk, path, distance) if stk.isEmpty()!=True: stk.pop() return 0 if __name__ == '__main__': g = Graph() distance=0 stack= Stack() path=[] f=open('input.txt', 'r') f.readline() k=f.readline() p=k.split(', ') for name in p: g.add_vertex(name) print name k=f.readline() while(k !=None): if(k==''): break elif(k!= 'Edges:\n'): p=k.split(', ') g.add_edge(p[0], p[1], int(p[2])) k=f.readline() else: k=f.readline() continue stack.push(g.get_vertex('houston')) g.get_vertex('houston').visited='yes'